forked from loafle/openapi-generator-original
file rename
This commit is contained in:
parent
f53b5e27e0
commit
52bc82149f
@ -1,31 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKApiInvoker.h"
|
|
||||||
#import "NIKApiTokenStatus.h"
|
|
||||||
#import "NIKWordList.h"
|
|
||||||
#import "NIKUser.h"
|
|
||||||
#import "NIKAuthenticationToken.h"
|
|
||||||
|
|
||||||
|
|
||||||
@interface NIKAccountApi: NSObject {
|
|
||||||
|
|
||||||
@private
|
|
||||||
NSOperationQueue *_queue;
|
|
||||||
NIKApiInvoker * _api;
|
|
||||||
}
|
|
||||||
@property(nonatomic, readonly) NSOperationQueue* queue;
|
|
||||||
@property(nonatomic, readonly) NIKApiInvoker* api;
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key;
|
|
||||||
|
|
||||||
-(void) authenticateWithCompletionBlock :(NSString*) username password:(NSString*) password
|
|
||||||
completionHandler:(void (^)(NIKAuthenticationToken*, NSError *))completionBlock;
|
|
||||||
-(void) authenticatePostWithCompletionBlock :(NSString*) username body:(NSString*) body
|
|
||||||
completionHandler:(void (^)(NIKAuthenticationToken*, NSError *))completionBlock;
|
|
||||||
-(void) getWordListsForLoggedInUserWithCompletionBlock :(NSString*) auth_token skip:(NSNumber*) skip limit:(NSNumber*) limit
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock;
|
|
||||||
-(void) getApiTokenStatusWithCompletionBlock :(NSString*) api_key
|
|
||||||
completionHandler:(void (^)(NIKApiTokenStatus*, NSError *))completionBlock;
|
|
||||||
-(void) getLoggedInUserWithCompletionBlock :(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NIKUser*, NSError *))completionBlock;
|
|
||||||
@end
|
|
@ -1,500 +0,0 @@
|
|||||||
#import "NIKAccountApi.h"
|
|
||||||
#import "NIKApiTokenStatus.h"
|
|
||||||
#import "NIKWordList.h"
|
|
||||||
#import "NIKUser.h"
|
|
||||||
#import "NIKAuthenticationToken.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation NIKAccountApi
|
|
||||||
static NSString * basePath = @"http://api.wordnik.com/v4";
|
|
||||||
|
|
||||||
@synthesize queue = _queue;
|
|
||||||
@synthesize api = _api;
|
|
||||||
|
|
||||||
- (id) init {
|
|
||||||
self = [super init];
|
|
||||||
_queue = [[NSOperationQueue alloc] init];
|
|
||||||
_api = [[NIKApiInvoker alloc] init];
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key {
|
|
||||||
[_api addHeader:value forKey:key];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKAuthenticationToken
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) authenticateWithCompletionBlock :(NSString*) username password:(NSString*) password
|
|
||||||
completionHandler:(void (^)(NIKAuthenticationToken*, NSError *))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: [_api escapeString:username]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(password != nil)
|
|
||||||
[queryParams setValue:password forKey:@"password"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(username == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(password == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock( [[NIKAuthenticationToken alloc]initWithValues: data], nil);}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKAuthenticationToken
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) authenticatePostWithCompletionBlock :(NSString*) username body:(NSString*) body
|
|
||||||
completionHandler:(void (^)(NIKAuthenticationToken*, NSError *))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: [_api escapeString:username]];
|
|
||||||
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:[(NIKSwaggerObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(NIKSwaggerObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(username == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(body == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"POST"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock( [[NIKAuthenticationToken alloc]initWithValues: data], nil);}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKWordList
|
|
||||||
* returnContainer: List
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) getWordListsForLoggedInUserWithCompletionBlock :(NSString*) auth_token skip:(NSNumber*) skip limit:(NSNumber*) limit
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))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"];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(skip != nil)
|
|
||||||
[queryParams setValue:skip forKey:@"skip"];
|
|
||||||
if(limit != nil)
|
|
||||||
[queryParams setValue:limit forKey:@"limit"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"auth_token"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(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) {
|
|
||||||
NIKWordList* d = [[NIKWordList alloc]initWithValues: dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
completionBlock(objs, nil);
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKApiTokenStatus
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) getApiTokenStatusWithCompletionBlock :(NSString*) api_key
|
|
||||||
completionHandler:(void (^)(NIKApiTokenStatus*, NSError *))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"];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(api_key != nil)
|
|
||||||
[headerParams setValue:api_key forKey:@"api_key"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock( [[NIKApiTokenStatus alloc]initWithValues: data], nil);}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKUser
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) getLoggedInUserWithCompletionBlock :(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NIKUser*, NSError *))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"];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"auth_token"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock( [[NIKUser alloc]initWithValues: data], nil);}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) authenticateAsJsonWithCompletionBlock :(NSString*) username password:(NSString*) password
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [_api escapeString:username]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(password != nil)
|
|
||||||
[queryParams setValue:password forKey:@"password"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(username == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(password == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) authenticatePostAsJsonWithCompletionBlock :(NSString*) username body:(NSString*) body
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [_api escapeString:username]];
|
|
||||||
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:[(NIKSwaggerObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(NIKSwaggerObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(username == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(body == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"POST"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) getWordListsForLoggedInUserAsJsonWithCompletionBlock :(NSString*) auth_token skip:(NSNumber*) skip limit:(NSNumber*) limit
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(skip != nil)
|
|
||||||
[queryParams setValue:skip forKey:@"skip"];
|
|
||||||
if(limit != nil)
|
|
||||||
[queryParams setValue:limit forKey:@"limit"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"auth_token"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) getApiTokenStatusAsJsonWithCompletionBlock :(NSString*) api_key
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(api_key != nil)
|
|
||||||
[headerParams setValue:api_key forKey:@"api_key"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) getLoggedInUserAsJsonWithCompletionBlock :(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"auth_token"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
@ -1,32 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
@interface NIKApiInvoker : NSObject {
|
|
||||||
|
|
||||||
@private
|
|
||||||
NSOperationQueue *_queue;
|
|
||||||
NSMutableDictionary * _defaultHeaders;
|
|
||||||
}
|
|
||||||
@property(nonatomic, readonly) NSOperationQueue* queue;
|
|
||||||
@property(nonatomic, readonly) NSMutableDictionary * defaultHeaders;
|
|
||||||
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key;
|
|
||||||
|
|
||||||
-(NSString*) escapeString:(NSString*) string;
|
|
||||||
|
|
||||||
-(id) dictionaryWithCompletionBlock:(NSString*) path
|
|
||||||
method:(NSString*) method
|
|
||||||
queryParams:(NSDictionary*) queryParams
|
|
||||||
body:(id)body
|
|
||||||
headerParams:(NSDictionary*) headerParams
|
|
||||||
completionHandler:(void (^)(NSDictionary*, NSError *))completionBlock;
|
|
||||||
|
|
||||||
-(id) stringWithCompletionBlock:(NSString*) path
|
|
||||||
method:(NSString*) method
|
|
||||||
queryParams:(NSDictionary*) queryParams
|
|
||||||
body:(id)body
|
|
||||||
headerParams:(NSDictionary*) headerParams
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))completionBlock;
|
|
||||||
|
|
||||||
@end
|
|
@ -1,222 +0,0 @@
|
|||||||
#import "NIKApiInvoker.h"
|
|
||||||
|
|
||||||
@implementation NIKApiInvoker
|
|
||||||
|
|
||||||
@synthesize queue = _queue;
|
|
||||||
@synthesize defaultHeaders = _defaultHeaders;
|
|
||||||
|
|
||||||
- (id) init {
|
|
||||||
self = [super init];
|
|
||||||
_queue = [[NSOperationQueue alloc] init];
|
|
||||||
_defaultHeaders = [[NSMutableDictionary alloc] init];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key {
|
|
||||||
[_defaultHeaders setValue:value forKey:key];
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSString*) escapeString:(NSString *)unescaped {
|
|
||||||
return (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(
|
|
||||||
NULL,
|
|
||||||
(__bridge CFStringRef) unescaped,
|
|
||||||
NULL,
|
|
||||||
(CFStringRef)@"!*'();:@&=+$,/?%#[]",
|
|
||||||
kCFStringEncodingUTF8));
|
|
||||||
}
|
|
||||||
|
|
||||||
-(id) dictionaryWithCompletionBlock:(NSString*) path
|
|
||||||
method:(NSString*) method
|
|
||||||
queryParams:(NSDictionary*) queryParams
|
|
||||||
body:(id) body
|
|
||||||
headerParams:(NSDictionary*) headerParams
|
|
||||||
completionHandler:(void (^)(NSDictionary*, NSError *))completionBlock
|
|
||||||
{
|
|
||||||
NSMutableString * requestUrl = [NSMutableString stringWithFormat:@"%@", path];
|
|
||||||
NSString * separator = nil;
|
|
||||||
int counter = 0;
|
|
||||||
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 = [self escapeString:[queryParams valueForKey:key]];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
value = [NSString stringWithFormat:@"%@", [queryParams valueForKey:key]];
|
|
||||||
}
|
|
||||||
[requestUrl appendString:[NSString stringWithFormat:@"%@%@=%@", separator,
|
|
||||||
[self escapeString:key], value]];
|
|
||||||
counter += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
NSLog(@"request url: %@", requestUrl);
|
|
||||||
|
|
||||||
NSURL* URL = [NSURL URLWithString:requestUrl];
|
|
||||||
|
|
||||||
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] init];
|
|
||||||
[request setURL:URL];
|
|
||||||
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
|
|
||||||
[request setTimeoutInterval:30];
|
|
||||||
|
|
||||||
for(NSString * key in [_defaultHeaders keyEnumerator]){
|
|
||||||
[request setValue:[_defaultHeaders valueForKey:key] forHTTPHeaderField:key];
|
|
||||||
}
|
|
||||||
if(headerParams != nil){
|
|
||||||
for(NSString * key in [headerParams keyEnumerator]){
|
|
||||||
[request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[request setHTTPMethod:method];
|
|
||||||
if(body != nil) {
|
|
||||||
NSError * error = [NSError new];
|
|
||||||
NSData * data = nil;
|
|
||||||
if([body isKindOfClass:[NSDictionary class]]){
|
|
||||||
data = [NSJSONSerialization dataWithJSONObject:body
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([body isKindOfClass:[NSArray class]]){
|
|
||||||
data = [NSJSONSerialization dataWithJSONObject:body
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
data = [body dataUsingEncoding:NSUTF8StringEncoding];
|
|
||||||
}
|
|
||||||
NSString *postLength = [NSString stringWithFormat:@"%ld", [data length]];
|
|
||||||
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
|
|
||||||
[request setHTTPBody:data];
|
|
||||||
|
|
||||||
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
|
||||||
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
|
|
||||||
|
|
||||||
NSLog(@"request: %@", request);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NSURLConnection sendAsynchronousRequest:request queue:_queue completionHandler:
|
|
||||||
^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
||||||
long statusCode = [(NSHTTPURLResponse*)response statusCode];
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (!NSLocationInRange(statusCode, NSMakeRange(200, 99))){
|
|
||||||
error = [NSError errorWithDomain:@"swagger"
|
|
||||||
code:statusCode
|
|
||||||
userInfo:[NSJSONSerialization JSONObjectWithData:data
|
|
||||||
options:kNilOptions
|
|
||||||
error:&error]];
|
|
||||||
completionBlock(nil, error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
NSDictionary* results = [NSJSONSerialization JSONObjectWithData:data
|
|
||||||
options:kNilOptions
|
|
||||||
error:&error];
|
|
||||||
completionBlock(results, nil);
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(id) stringWithCompletionBlock:(NSString*) path
|
|
||||||
method:(NSString*) method
|
|
||||||
queryParams:(NSDictionary*) queryParams
|
|
||||||
body:(id) body
|
|
||||||
headerParams:(NSDictionary*) headerParams
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))completionBlock
|
|
||||||
{
|
|
||||||
NSMutableString * requestUrl = [NSMutableString stringWithFormat:@"%@", path];
|
|
||||||
NSString * separator = nil;
|
|
||||||
int counter = 0;
|
|
||||||
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 = [self escapeString:[queryParams valueForKey:key]];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
value = [NSString stringWithFormat:@"%@", [queryParams valueForKey:key]];
|
|
||||||
}
|
|
||||||
[requestUrl appendFormat:[NSString stringWithFormat:@"%@%@=%@", separator,
|
|
||||||
[self escapeString:key], value]];
|
|
||||||
counter += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
NSLog(@"request url: %@", requestUrl);
|
|
||||||
|
|
||||||
NSURL* URL = [NSURL URLWithString:requestUrl];
|
|
||||||
|
|
||||||
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] init];
|
|
||||||
[request setURL:URL];
|
|
||||||
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
|
|
||||||
[request setTimeoutInterval:30];
|
|
||||||
|
|
||||||
for(NSString * key in [_defaultHeaders keyEnumerator]){
|
|
||||||
[request setValue:[_defaultHeaders valueForKey:key] forHTTPHeaderField:key];
|
|
||||||
}
|
|
||||||
if(headerParams != nil){
|
|
||||||
for(NSString * key in [headerParams keyEnumerator]){
|
|
||||||
[request setValue:[headerParams valueForKey:key] forHTTPHeaderField:key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[request setHTTPMethod:method];
|
|
||||||
if(body != nil) {
|
|
||||||
NSError * error = [NSError new];
|
|
||||||
NSData * data = nil;
|
|
||||||
if([body isKindOfClass:[NSDictionary class]]){
|
|
||||||
data = [NSJSONSerialization dataWithJSONObject:body
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([body isKindOfClass:[NSArray class]]){
|
|
||||||
data = [NSJSONSerialization dataWithJSONObject:body
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
data = [body dataUsingEncoding:NSUTF8StringEncoding];
|
|
||||||
}
|
|
||||||
NSString *postLength = [NSString stringWithFormat:@"%d", [data length]];
|
|
||||||
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
|
|
||||||
[request setHTTPBody:data];
|
|
||||||
|
|
||||||
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
|
||||||
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
|
|
||||||
|
|
||||||
NSLog(@"request: %@", request);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NSURLConnection sendAsynchronousRequest:request queue:_queue completionHandler:
|
|
||||||
^(NSURLResponse *response, NSData *data, NSError *error) {
|
|
||||||
int statusCode = [(NSHTTPURLResponse*)response statusCode];
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (!NSLocationInRange(statusCode, NSMakeRange(200, 99))){
|
|
||||||
error = [NSError errorWithDomain:@"swagger"
|
|
||||||
code:statusCode
|
|
||||||
userInfo:[NSJSONSerialization JSONObjectWithData:data
|
|
||||||
options:kNilOptions
|
|
||||||
error:&error]];
|
|
||||||
completionBlock(nil, error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
NSString* results = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
|
||||||
|
|
||||||
if(results && [results length] >= 2) {
|
|
||||||
if(([results characterAtIndex:0] == '\"') && ([results characterAtIndex:([results length] - 1) == '\"'])){
|
|
||||||
results = [results substringWithRange:NSMakeRange(1, [results length] -2)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
completionBlock(results, nil);
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
@end
|
|
@ -1,34 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKApiTokenStatus : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* _valid; //NSNumber
|
|
||||||
NSString* _token; //NSString
|
|
||||||
NSNumber* _resetsInMillis; //NSNumber
|
|
||||||
NSNumber* _remainingCalls; //NSNumber
|
|
||||||
NSNumber* _expiresInMillis; //NSNumber
|
|
||||||
NSNumber* _totalRequests; //NSNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKApiTokenStatus.h"
|
|
||||||
|
|
||||||
@implementation NIKApiTokenStatus
|
|
||||||
|
|
||||||
@synthesize valid = _valid;
|
|
||||||
@synthesize token = _token;
|
|
||||||
@synthesize resetsInMillis = _resetsInMillis;
|
|
||||||
@synthesize remainingCalls = _remainingCalls;
|
|
||||||
@synthesize expiresInMillis = _expiresInMillis;
|
|
||||||
@synthesize totalRequests = _totalRequests;
|
|
||||||
- (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
|
|
||||||
{
|
|
||||||
_valid = [dict objectForKey:@"valid"];
|
|
||||||
_token = [dict objectForKey:@"token"];
|
|
||||||
_resetsInMillis = [dict objectForKey:@"resetsInMillis"];
|
|
||||||
_remainingCalls = [dict objectForKey:@"remainingCalls"];
|
|
||||||
_expiresInMillis = [dict objectForKey:@"expiresInMillis"];
|
|
||||||
_totalRequests = [dict objectForKey:@"totalRequests"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_valid != nil) [dict setObject:_valid forKey:@"valid"];
|
|
||||||
if(_token != nil) [dict setObject:_token forKey:@"token"];
|
|
||||||
if(_resetsInMillis != nil) [dict setObject:_resetsInMillis forKey:@"resetsInMillis"];
|
|
||||||
if(_remainingCalls != nil) [dict setObject:_remainingCalls forKey:@"remainingCalls"];
|
|
||||||
if(_expiresInMillis != nil) [dict setObject:_expiresInMillis forKey:@"expiresInMillis"];
|
|
||||||
if(_totalRequests != nil) [dict setObject:_totalRequests forKey:@"totalRequests"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKDate.h"
|
|
||||||
|
|
||||||
@interface NIKAudioFile : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _attributionUrl; //NSString
|
|
||||||
NSNumber* _commentCount; //NSNumber
|
|
||||||
NSNumber* _voteCount; //NSNumber
|
|
||||||
NSString* _fileUrl; //NSString
|
|
||||||
NSString* _audioType; //NSString
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSNumber* _duration; //NSNumber
|
|
||||||
NSString* _attributionText; //NSString
|
|
||||||
NSString* _createdBy; //NSString
|
|
||||||
NSString* _description; //NSString
|
|
||||||
NIKDate* _createdAt; //NIKDate
|
|
||||||
NSNumber* _voteWeightedAverage; //NSNumber
|
|
||||||
NSNumber* _voteAverage; //NSNumber
|
|
||||||
NSString* _word; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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) NIKDate* 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: (NIKDate*) createdAt
|
|
||||||
voteWeightedAverage: (NSNumber*) voteWeightedAverage
|
|
||||||
voteAverage: (NSNumber*) voteAverage
|
|
||||||
word: (NSString*) word;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKAudioFile.h"
|
|
||||||
|
|
||||||
@implementation NIKAudioFile
|
|
||||||
|
|
||||||
@synthesize attributionUrl = _attributionUrl;
|
|
||||||
@synthesize commentCount = _commentCount;
|
|
||||||
@synthesize voteCount = _voteCount;
|
|
||||||
@synthesize fileUrl = _fileUrl;
|
|
||||||
@synthesize audioType = _audioType;
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize duration = _duration;
|
|
||||||
@synthesize attributionText = _attributionText;
|
|
||||||
@synthesize createdBy = _createdBy;
|
|
||||||
@synthesize description = _description;
|
|
||||||
@synthesize createdAt = _createdAt;
|
|
||||||
@synthesize voteWeightedAverage = _voteWeightedAverage;
|
|
||||||
@synthesize voteAverage = _voteAverage;
|
|
||||||
@synthesize word = _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: (NIKDate*) 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
|
|
||||||
{
|
|
||||||
_attributionUrl = [dict objectForKey:@"attributionUrl"];
|
|
||||||
_commentCount = [dict objectForKey:@"commentCount"];
|
|
||||||
_voteCount = [dict objectForKey:@"voteCount"];
|
|
||||||
_fileUrl = [dict objectForKey:@"fileUrl"];
|
|
||||||
_audioType = [dict objectForKey:@"audioType"];
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
_duration = [dict objectForKey:@"duration"];
|
|
||||||
_attributionText = [dict objectForKey:@"attributionText"];
|
|
||||||
_createdBy = [dict objectForKey:@"createdBy"];
|
|
||||||
_description = [dict objectForKey:@"description"];
|
|
||||||
id createdAt_dict = [dict objectForKey:@"createdAt"];
|
|
||||||
_createdAt = [[NIKDate alloc]initWithValues:createdAt_dict];
|
|
||||||
_voteWeightedAverage = [dict objectForKey:@"voteWeightedAverage"];
|
|
||||||
_voteAverage = [dict objectForKey:@"voteAverage"];
|
|
||||||
_word = [dict objectForKey:@"word"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_attributionUrl != nil) [dict setObject:_attributionUrl forKey:@"attributionUrl"];
|
|
||||||
if(_commentCount != nil) [dict setObject:_commentCount forKey:@"commentCount"];
|
|
||||||
if(_voteCount != nil) [dict setObject:_voteCount forKey:@"voteCount"];
|
|
||||||
if(_fileUrl != nil) [dict setObject:_fileUrl forKey:@"fileUrl"];
|
|
||||||
if(_audioType != nil) [dict setObject:_audioType forKey:@"audioType"];
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_duration != nil) [dict setObject:_duration forKey:@"duration"];
|
|
||||||
if(_attributionText != nil) [dict setObject:_attributionText forKey:@"attributionText"];
|
|
||||||
if(_createdBy != nil) [dict setObject:_createdBy forKey:@"createdBy"];
|
|
||||||
if(_description != nil) [dict setObject:_description forKey:@"description"];
|
|
||||||
if(_createdAt != nil){
|
|
||||||
if([_createdAt isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKDate * createdAt in (NSArray*)_createdAt) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)createdAt asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
else if(_createdAt && [_createdAt isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_createdAt toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_createdAt != nil) [dict setObject:[(NIKSwaggerObject*)_createdAt asDictionary]forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
if(_voteWeightedAverage != nil) [dict setObject:_voteWeightedAverage forKey:@"voteWeightedAverage"];
|
|
||||||
if(_voteAverage != nil) [dict setObject:_voteAverage forKey:@"voteAverage"];
|
|
||||||
if(_word != nil) [dict setObject:_word forKey:@"word"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKAuthenticationToken : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _token; //NSString
|
|
||||||
NSNumber* _userId; //NSNumber
|
|
||||||
NSString* _userSignature; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKAuthenticationToken.h"
|
|
||||||
|
|
||||||
@implementation NIKAuthenticationToken
|
|
||||||
|
|
||||||
@synthesize token = _token;
|
|
||||||
@synthesize userId = _userId;
|
|
||||||
@synthesize userSignature = _userSignature;
|
|
||||||
- (id) token: (NSString*) token
|
|
||||||
userId: (NSNumber*) userId
|
|
||||||
userSignature: (NSString*) userSignature
|
|
||||||
{
|
|
||||||
_token = token;
|
|
||||||
_userId = userId;
|
|
||||||
_userSignature = userSignature;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
_token = [dict objectForKey:@"token"];
|
|
||||||
_userId = [dict objectForKey:@"userId"];
|
|
||||||
_userSignature = [dict objectForKey:@"userSignature"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_token != nil) [dict setObject:_token forKey:@"token"];
|
|
||||||
if(_userId != nil) [dict setObject:_userId forKey:@"userId"];
|
|
||||||
if(_userSignature != nil) [dict setObject:_userSignature forKey:@"userSignature"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKBigram : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* _count; //NSNumber
|
|
||||||
NSString* _gram2; //NSString
|
|
||||||
NSString* _gram1; //NSString
|
|
||||||
NSNumber* _wlmi; //NSNumber
|
|
||||||
NSNumber* _mi; //NSNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKBigram.h"
|
|
||||||
|
|
||||||
@implementation NIKBigram
|
|
||||||
|
|
||||||
@synthesize count = _count;
|
|
||||||
@synthesize gram2 = _gram2;
|
|
||||||
@synthesize gram1 = _gram1;
|
|
||||||
@synthesize wlmi = _wlmi;
|
|
||||||
@synthesize mi = _mi;
|
|
||||||
- (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
|
|
||||||
{
|
|
||||||
_count = [dict objectForKey:@"count"];
|
|
||||||
_gram2 = [dict objectForKey:@"gram2"];
|
|
||||||
_gram1 = [dict objectForKey:@"gram1"];
|
|
||||||
_wlmi = [dict objectForKey:@"wlmi"];
|
|
||||||
_mi = [dict objectForKey:@"mi"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_count != nil) [dict setObject:_count forKey:@"count"];
|
|
||||||
if(_gram2 != nil) [dict setObject:_gram2 forKey:@"gram2"];
|
|
||||||
if(_gram1 != nil) [dict setObject:_gram1 forKey:@"gram1"];
|
|
||||||
if(_wlmi != nil) [dict setObject:_wlmi forKey:@"wlmi"];
|
|
||||||
if(_mi != nil) [dict setObject:_mi forKey:@"mi"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKCitation : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _cite; //NSString
|
|
||||||
NSString* _source; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSString* cite;
|
|
||||||
@property(nonatomic) NSString* source;
|
|
||||||
- (id) cite: (NSString*) cite
|
|
||||||
source: (NSString*) source;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKCitation.h"
|
|
||||||
|
|
||||||
@implementation NIKCitation
|
|
||||||
|
|
||||||
@synthesize cite = _cite;
|
|
||||||
@synthesize source = _source;
|
|
||||||
- (id) cite: (NSString*) cite
|
|
||||||
source: (NSString*) source
|
|
||||||
{
|
|
||||||
_cite = cite;
|
|
||||||
_source = source;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
_cite = [dict objectForKey:@"cite"];
|
|
||||||
_source = [dict objectForKey:@"source"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_cite != nil) [dict setObject:_cite forKey:@"cite"];
|
|
||||||
if(_source != nil) [dict setObject:_source forKey:@"source"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKContentProvider : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSString* _name; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* _id;
|
|
||||||
@property(nonatomic) NSString* name;
|
|
||||||
- (id) _id: (NSNumber*) _id
|
|
||||||
name: (NSString*) name;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKContentProvider.h"
|
|
||||||
|
|
||||||
@implementation NIKContentProvider
|
|
||||||
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize name = _name;
|
|
||||||
- (id) _id: (NSNumber*) _id
|
|
||||||
name: (NSString*) name
|
|
||||||
{
|
|
||||||
__id = _id;
|
|
||||||
_name = name;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
_name = [dict objectForKey:@"name"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_name != nil) [dict setObject:_name forKey:@"name"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKDate : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSDate *_date;
|
|
||||||
}
|
|
||||||
@property(nonatomic, readonly) NSDate* date;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSString*)input;
|
|
||||||
-(NSString*) toString;
|
|
||||||
@end
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
|
|
||||||
@implementation NIKDate
|
|
||||||
|
|
||||||
@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
|
|
@ -1,70 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKExampleUsage.h"
|
|
||||||
#import "NIKNote.h"
|
|
||||||
#import "NIKCitation.h"
|
|
||||||
#import "NIKTextPron.h"
|
|
||||||
#import "NIKLabel.h"
|
|
||||||
#import "NIKRelated.h"
|
|
||||||
|
|
||||||
@interface NIKDefinition : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _extendedText; //NSString
|
|
||||||
NSString* _text; //NSString
|
|
||||||
NSString* _sourceDictionary; //NSString
|
|
||||||
NSArray* _citations; //Citation
|
|
||||||
NSArray* _labels; //Label
|
|
||||||
NSNumber* _score; //NSNumber
|
|
||||||
NSArray* _exampleUses; //ExampleUsage
|
|
||||||
NSString* _attributionUrl; //NSString
|
|
||||||
NSString* _seqString; //NSString
|
|
||||||
NSString* _attributionText; //NSString
|
|
||||||
NSArray* _relatedWords; //Related
|
|
||||||
NSString* _sequence; //NSString
|
|
||||||
NSString* _word; //NSString
|
|
||||||
NSArray* _notes; //Note
|
|
||||||
NSArray* _textProns; //TextPron
|
|
||||||
NSString* _partOfSpeech; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,264 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKDefinition.h"
|
|
||||||
|
|
||||||
@implementation NIKDefinition
|
|
||||||
|
|
||||||
@synthesize extendedText = _extendedText;
|
|
||||||
@synthesize text = _text;
|
|
||||||
@synthesize sourceDictionary = _sourceDictionary;
|
|
||||||
@synthesize citations = _citations;
|
|
||||||
@synthesize labels = _labels;
|
|
||||||
@synthesize score = _score;
|
|
||||||
@synthesize exampleUses = _exampleUses;
|
|
||||||
@synthesize attributionUrl = _attributionUrl;
|
|
||||||
@synthesize seqString = _seqString;
|
|
||||||
@synthesize attributionText = _attributionText;
|
|
||||||
@synthesize relatedWords = _relatedWords;
|
|
||||||
@synthesize sequence = _sequence;
|
|
||||||
@synthesize word = _word;
|
|
||||||
@synthesize notes = _notes;
|
|
||||||
@synthesize textProns = _textProns;
|
|
||||||
@synthesize partOfSpeech = _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
|
|
||||||
{
|
|
||||||
_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
|
|
||||||
{
|
|
||||||
_extendedText = [dict objectForKey:@"extendedText"];
|
|
||||||
_text = [dict objectForKey:@"text"];
|
|
||||||
_sourceDictionary = [dict objectForKey:@"sourceDictionary"];
|
|
||||||
id citations_dict = [dict objectForKey:@"citations"];
|
|
||||||
if([citations_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)citations_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)citations_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)citations_dict) {
|
|
||||||
NIKCitation* d = [[NIKCitation alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_citations = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
id labels_dict = [dict objectForKey:@"labels"];
|
|
||||||
if([labels_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)labels_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)labels_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)labels_dict) {
|
|
||||||
NIKLabel* d = [[NIKLabel alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_labels = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_score = [dict objectForKey:@"score"];
|
|
||||||
id exampleUses_dict = [dict objectForKey:@"exampleUses"];
|
|
||||||
if([exampleUses_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)exampleUses_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)exampleUses_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)exampleUses_dict) {
|
|
||||||
NIKExampleUsage* d = [[NIKExampleUsage alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_exampleUses = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_attributionUrl = [dict objectForKey:@"attributionUrl"];
|
|
||||||
_seqString = [dict objectForKey:@"seqString"];
|
|
||||||
_attributionText = [dict objectForKey:@"attributionText"];
|
|
||||||
id relatedWords_dict = [dict objectForKey:@"relatedWords"];
|
|
||||||
if([relatedWords_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)relatedWords_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)relatedWords_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)relatedWords_dict) {
|
|
||||||
NIKRelated* d = [[NIKRelated alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_relatedWords = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_sequence = [dict objectForKey:@"sequence"];
|
|
||||||
_word = [dict objectForKey:@"word"];
|
|
||||||
id notes_dict = [dict objectForKey:@"notes"];
|
|
||||||
if([notes_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)notes_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)notes_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)notes_dict) {
|
|
||||||
NIKNote* d = [[NIKNote alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_notes = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
id textProns_dict = [dict objectForKey:@"textProns"];
|
|
||||||
if([textProns_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)textProns_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)textProns_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)textProns_dict) {
|
|
||||||
NIKTextPron* d = [[NIKTextPron alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_textProns = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_partOfSpeech = [dict objectForKey:@"partOfSpeech"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_extendedText != nil) [dict setObject:_extendedText forKey:@"extendedText"];
|
|
||||||
if(_text != nil) [dict setObject:_text forKey:@"text"];
|
|
||||||
if(_sourceDictionary != nil) [dict setObject:_sourceDictionary forKey:@"sourceDictionary"];
|
|
||||||
if(_citations != nil){
|
|
||||||
if([_citations isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKCitation * citations in (NSArray*)_citations) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)citations asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"citations"];
|
|
||||||
}
|
|
||||||
else if(_citations && [_citations isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_citations toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"citations"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_citations != nil) [dict setObject:[(NIKSwaggerObject*)_citations asDictionary]forKey:@"citations"];
|
|
||||||
}
|
|
||||||
if(_labels != nil){
|
|
||||||
if([_labels isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKLabel * labels in (NSArray*)_labels) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)labels asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"labels"];
|
|
||||||
}
|
|
||||||
else if(_labels && [_labels isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_labels toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"labels"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_labels != nil) [dict setObject:[(NIKSwaggerObject*)_labels asDictionary]forKey:@"labels"];
|
|
||||||
}
|
|
||||||
if(_score != nil) [dict setObject:_score forKey:@"score"];
|
|
||||||
if(_exampleUses != nil){
|
|
||||||
if([_exampleUses isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKExampleUsage * exampleUses in (NSArray*)_exampleUses) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)exampleUses asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"exampleUses"];
|
|
||||||
}
|
|
||||||
else if(_exampleUses && [_exampleUses isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_exampleUses toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"exampleUses"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_exampleUses != nil) [dict setObject:[(NIKSwaggerObject*)_exampleUses asDictionary]forKey:@"exampleUses"];
|
|
||||||
}
|
|
||||||
if(_attributionUrl != nil) [dict setObject:_attributionUrl forKey:@"attributionUrl"];
|
|
||||||
if(_seqString != nil) [dict setObject:_seqString forKey:@"seqString"];
|
|
||||||
if(_attributionText != nil) [dict setObject:_attributionText forKey:@"attributionText"];
|
|
||||||
if(_relatedWords != nil){
|
|
||||||
if([_relatedWords isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKRelated * relatedWords in (NSArray*)_relatedWords) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)relatedWords asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"relatedWords"];
|
|
||||||
}
|
|
||||||
else if(_relatedWords && [_relatedWords isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_relatedWords toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"relatedWords"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_relatedWords != nil) [dict setObject:[(NIKSwaggerObject*)_relatedWords asDictionary]forKey:@"relatedWords"];
|
|
||||||
}
|
|
||||||
if(_sequence != nil) [dict setObject:_sequence forKey:@"sequence"];
|
|
||||||
if(_word != nil) [dict setObject:_word forKey:@"word"];
|
|
||||||
if(_notes != nil){
|
|
||||||
if([_notes isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKNote * notes in (NSArray*)_notes) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)notes asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"notes"];
|
|
||||||
}
|
|
||||||
else if(_notes && [_notes isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_notes toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"notes"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_notes != nil) [dict setObject:[(NIKSwaggerObject*)_notes asDictionary]forKey:@"notes"];
|
|
||||||
}
|
|
||||||
if(_textProns != nil){
|
|
||||||
if([_textProns isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKTextPron * textProns in (NSArray*)_textProns) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)textProns asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"textProns"];
|
|
||||||
}
|
|
||||||
else if(_textProns && [_textProns isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_textProns toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"textProns"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_textProns != nil) [dict setObject:[(NIKSwaggerObject*)_textProns asDictionary]forKey:@"textProns"];
|
|
||||||
}
|
|
||||||
if(_partOfSpeech != nil) [dict setObject:_partOfSpeech forKey:@"partOfSpeech"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKDefinition.h"
|
|
||||||
|
|
||||||
@interface NIKDefinitionSearchResults : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSArray* _results; //Definition
|
|
||||||
NSNumber* _totalResults; //NSNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSArray* results;
|
|
||||||
@property(nonatomic) NSNumber* totalResults;
|
|
||||||
- (id) results: (NSArray*) results
|
|
||||||
totalResults: (NSNumber*) totalResults;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKDefinitionSearchResults.h"
|
|
||||||
|
|
||||||
@implementation NIKDefinitionSearchResults
|
|
||||||
|
|
||||||
@synthesize results = _results;
|
|
||||||
@synthesize totalResults = _totalResults;
|
|
||||||
- (id) results: (NSArray*) results
|
|
||||||
totalResults: (NSNumber*) totalResults
|
|
||||||
{
|
|
||||||
_results = results;
|
|
||||||
_totalResults = totalResults;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
id results_dict = [dict objectForKey:@"results"];
|
|
||||||
if([results_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)results_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)results_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)results_dict) {
|
|
||||||
NIKDefinition* d = [[NIKDefinition alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_results = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_totalResults = [dict objectForKey:@"totalResults"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_results != nil){
|
|
||||||
if([_results isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKDefinition * results in (NSArray*)_results) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)results asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"results"];
|
|
||||||
}
|
|
||||||
else if(_results && [_results isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_results toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"results"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_results != nil) [dict setObject:[(NIKSwaggerObject*)_results asDictionary]forKey:@"results"];
|
|
||||||
}
|
|
||||||
if(_totalResults != nil) [dict setObject:_totalResults forKey:@"totalResults"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKSentence.h"
|
|
||||||
#import "NIKScoredWord.h"
|
|
||||||
#import "NIKContentProvider.h"
|
|
||||||
|
|
||||||
@interface NIKExample : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSNumber* _exampleId; //NSNumber
|
|
||||||
NSString* _title; //NSString
|
|
||||||
NSString* _text; //NSString
|
|
||||||
NIKScoredWord* _score; //ScoredWord
|
|
||||||
NIKSentence* _sentence; //Sentence
|
|
||||||
NSString* _word; //NSString
|
|
||||||
NIKContentProvider* _provider; //ContentProvider
|
|
||||||
NSNumber* _year; //NSNumber
|
|
||||||
NSNumber* _rating; //NSNumber
|
|
||||||
NSNumber* _documentId; //NSNumber
|
|
||||||
NSString* _url; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* _id;
|
|
||||||
@property(nonatomic) NSNumber* exampleId;
|
|
||||||
@property(nonatomic) NSString* title;
|
|
||||||
@property(nonatomic) NSString* text;
|
|
||||||
@property(nonatomic) NIKScoredWord* score;
|
|
||||||
@property(nonatomic) NIKSentence* sentence;
|
|
||||||
@property(nonatomic) NSString* word;
|
|
||||||
@property(nonatomic) NIKContentProvider* 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: (NIKScoredWord*) score
|
|
||||||
sentence: (NIKSentence*) sentence
|
|
||||||
word: (NSString*) word
|
|
||||||
provider: (NIKContentProvider*) provider
|
|
||||||
year: (NSNumber*) year
|
|
||||||
rating: (NSNumber*) rating
|
|
||||||
documentId: (NSNumber*) documentId
|
|
||||||
url: (NSString*) url;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,136 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKExample.h"
|
|
||||||
|
|
||||||
@implementation NIKExample
|
|
||||||
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize exampleId = _exampleId;
|
|
||||||
@synthesize title = _title;
|
|
||||||
@synthesize text = _text;
|
|
||||||
@synthesize score = _score;
|
|
||||||
@synthesize sentence = _sentence;
|
|
||||||
@synthesize word = _word;
|
|
||||||
@synthesize provider = _provider;
|
|
||||||
@synthesize year = _year;
|
|
||||||
@synthesize rating = _rating;
|
|
||||||
@synthesize documentId = _documentId;
|
|
||||||
@synthesize url = _url;
|
|
||||||
- (id) _id: (NSNumber*) _id
|
|
||||||
exampleId: (NSNumber*) exampleId
|
|
||||||
title: (NSString*) title
|
|
||||||
text: (NSString*) text
|
|
||||||
score: (NIKScoredWord*) score
|
|
||||||
sentence: (NIKSentence*) sentence
|
|
||||||
word: (NSString*) word
|
|
||||||
provider: (NIKContentProvider*) 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
|
|
||||||
{
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
_exampleId = [dict objectForKey:@"exampleId"];
|
|
||||||
_title = [dict objectForKey:@"title"];
|
|
||||||
_text = [dict objectForKey:@"text"];
|
|
||||||
id score_dict = [dict objectForKey:@"score"];
|
|
||||||
_score = [[NIKScoredWord alloc]initWithValues:score_dict];
|
|
||||||
id sentence_dict = [dict objectForKey:@"sentence"];
|
|
||||||
_sentence = [[NIKSentence alloc]initWithValues:sentence_dict];
|
|
||||||
_word = [dict objectForKey:@"word"];
|
|
||||||
id provider_dict = [dict objectForKey:@"provider"];
|
|
||||||
_provider = [[NIKContentProvider alloc]initWithValues:provider_dict];
|
|
||||||
_year = [dict objectForKey:@"year"];
|
|
||||||
_rating = [dict objectForKey:@"rating"];
|
|
||||||
_documentId = [dict objectForKey:@"documentId"];
|
|
||||||
_url = [dict objectForKey:@"url"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_exampleId != nil) [dict setObject:_exampleId forKey:@"exampleId"];
|
|
||||||
if(_title != nil) [dict setObject:_title forKey:@"title"];
|
|
||||||
if(_text != nil) [dict setObject:_text forKey:@"text"];
|
|
||||||
if(_score != nil){
|
|
||||||
if([_score isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKScoredWord * score in (NSArray*)_score) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)score asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"score"];
|
|
||||||
}
|
|
||||||
else if(_score && [_score isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_score toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"score"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_score != nil) [dict setObject:[(NIKSwaggerObject*)_score asDictionary]forKey:@"score"];
|
|
||||||
}
|
|
||||||
if(_sentence != nil){
|
|
||||||
if([_sentence isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKSentence * sentence in (NSArray*)_sentence) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)sentence asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"sentence"];
|
|
||||||
}
|
|
||||||
else if(_sentence && [_sentence isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_sentence toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"sentence"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_sentence != nil) [dict setObject:[(NIKSwaggerObject*)_sentence asDictionary]forKey:@"sentence"];
|
|
||||||
}
|
|
||||||
if(_word != nil) [dict setObject:_word forKey:@"word"];
|
|
||||||
if(_provider != nil){
|
|
||||||
if([_provider isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKContentProvider * provider in (NSArray*)_provider) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)provider asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"provider"];
|
|
||||||
}
|
|
||||||
else if(_provider && [_provider isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_provider toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"provider"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_provider != nil) [dict setObject:[(NIKSwaggerObject*)_provider asDictionary]forKey:@"provider"];
|
|
||||||
}
|
|
||||||
if(_year != nil) [dict setObject:_year forKey:@"year"];
|
|
||||||
if(_rating != nil) [dict setObject:_rating forKey:@"rating"];
|
|
||||||
if(_documentId != nil) [dict setObject:_documentId forKey:@"documentId"];
|
|
||||||
if(_url != nil) [dict setObject:_url forKey:@"url"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKFacet.h"
|
|
||||||
#import "NIKExample.h"
|
|
||||||
|
|
||||||
@interface NIKExampleSearchResults : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSArray* _facets; //Facet
|
|
||||||
NSArray* _examples; //Example
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSArray* facets;
|
|
||||||
@property(nonatomic) NSArray* examples;
|
|
||||||
- (id) facets: (NSArray*) facets
|
|
||||||
examples: (NSArray*) examples;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKExampleSearchResults.h"
|
|
||||||
|
|
||||||
@implementation NIKExampleSearchResults
|
|
||||||
|
|
||||||
@synthesize facets = _facets;
|
|
||||||
@synthesize examples = _examples;
|
|
||||||
- (id) facets: (NSArray*) facets
|
|
||||||
examples: (NSArray*) examples
|
|
||||||
{
|
|
||||||
_facets = facets;
|
|
||||||
_examples = examples;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
id facets_dict = [dict objectForKey:@"facets"];
|
|
||||||
if([facets_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)facets_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)facets_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)facets_dict) {
|
|
||||||
NIKFacet* d = [[NIKFacet alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_facets = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
id examples_dict = [dict objectForKey:@"examples"];
|
|
||||||
if([examples_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)examples_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)examples_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)examples_dict) {
|
|
||||||
NIKExample* d = [[NIKExample alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_examples = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_facets != nil){
|
|
||||||
if([_facets isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKFacet * facets in (NSArray*)_facets) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)facets asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"facets"];
|
|
||||||
}
|
|
||||||
else if(_facets && [_facets isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_facets toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"facets"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_facets != nil) [dict setObject:[(NIKSwaggerObject*)_facets asDictionary]forKey:@"facets"];
|
|
||||||
}
|
|
||||||
if(_examples != nil){
|
|
||||||
if([_examples isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKExample * examples in (NSArray*)_examples) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)examples asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"examples"];
|
|
||||||
}
|
|
||||||
else if(_examples && [_examples isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_examples toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"examples"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_examples != nil) [dict setObject:[(NIKSwaggerObject*)_examples asDictionary]forKey:@"examples"];
|
|
||||||
}
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKExampleUsage : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _text; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSString* text;
|
|
||||||
- (id) text: (NSString*) text;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKExampleUsage.h"
|
|
||||||
|
|
||||||
@implementation NIKExampleUsage
|
|
||||||
|
|
||||||
@synthesize text = _text;
|
|
||||||
- (id) text: (NSString*) text
|
|
||||||
{
|
|
||||||
_text = text;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
_text = [dict objectForKey:@"text"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_text != nil) [dict setObject:_text forKey:@"text"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKFacetValue.h"
|
|
||||||
|
|
||||||
@interface NIKFacet : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSArray* _facetValues; //FacetValue
|
|
||||||
NSString* _name; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSArray* facetValues;
|
|
||||||
@property(nonatomic) NSString* name;
|
|
||||||
- (id) facetValues: (NSArray*) facetValues
|
|
||||||
name: (NSString*) name;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKFacet.h"
|
|
||||||
|
|
||||||
@implementation NIKFacet
|
|
||||||
|
|
||||||
@synthesize facetValues = _facetValues;
|
|
||||||
@synthesize name = _name;
|
|
||||||
- (id) facetValues: (NSArray*) facetValues
|
|
||||||
name: (NSString*) name
|
|
||||||
{
|
|
||||||
_facetValues = facetValues;
|
|
||||||
_name = name;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
id facetValues_dict = [dict objectForKey:@"facetValues"];
|
|
||||||
if([facetValues_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)facetValues_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)facetValues_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)facetValues_dict) {
|
|
||||||
NIKFacetValue* d = [[NIKFacetValue alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_facetValues = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_name = [dict objectForKey:@"name"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_facetValues != nil){
|
|
||||||
if([_facetValues isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKFacetValue * facetValues in (NSArray*)_facetValues) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)facetValues asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"facetValues"];
|
|
||||||
}
|
|
||||||
else if(_facetValues && [_facetValues isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_facetValues toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"facetValues"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_facetValues != nil) [dict setObject:[(NIKSwaggerObject*)_facetValues asDictionary]forKey:@"facetValues"];
|
|
||||||
}
|
|
||||||
if(_name != nil) [dict setObject:_name forKey:@"name"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKFacetValue : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* _count; //NSNumber
|
|
||||||
NSString* _value; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* count;
|
|
||||||
@property(nonatomic) NSString* value;
|
|
||||||
- (id) count: (NSNumber*) count
|
|
||||||
value: (NSString*) value;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKFacetValue.h"
|
|
||||||
|
|
||||||
@implementation NIKFacetValue
|
|
||||||
|
|
||||||
@synthesize count = _count;
|
|
||||||
@synthesize value = _value;
|
|
||||||
- (id) count: (NSNumber*) count
|
|
||||||
value: (NSString*) value
|
|
||||||
{
|
|
||||||
_count = count;
|
|
||||||
_value = value;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
_count = [dict objectForKey:@"count"];
|
|
||||||
_value = [dict objectForKey:@"value"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_count != nil) [dict setObject:_count forKey:@"count"];
|
|
||||||
if(_value != nil) [dict setObject:_value forKey:@"value"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKFrequency : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* _count; //NSNumber
|
|
||||||
NSNumber* _year; //NSNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* count;
|
|
||||||
@property(nonatomic) NSNumber* year;
|
|
||||||
- (id) count: (NSNumber*) count
|
|
||||||
year: (NSNumber*) year;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKFrequency.h"
|
|
||||||
|
|
||||||
@implementation NIKFrequency
|
|
||||||
|
|
||||||
@synthesize count = _count;
|
|
||||||
@synthesize year = _year;
|
|
||||||
- (id) count: (NSNumber*) count
|
|
||||||
year: (NSNumber*) year
|
|
||||||
{
|
|
||||||
_count = count;
|
|
||||||
_year = year;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
_count = [dict objectForKey:@"count"];
|
|
||||||
_year = [dict objectForKey:@"year"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_count != nil) [dict setObject:_count forKey:@"count"];
|
|
||||||
if(_year != nil) [dict setObject:_year forKey:@"year"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKFrequency.h"
|
|
||||||
|
|
||||||
@interface NIKFrequencySummary : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* _unknownYearCount; //NSNumber
|
|
||||||
NSNumber* _totalCount; //NSNumber
|
|
||||||
NSString* _frequencyString; //NSString
|
|
||||||
NSString* _word; //NSString
|
|
||||||
NSArray* _frequency; //Frequency
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKFrequencySummary.h"
|
|
||||||
|
|
||||||
@implementation NIKFrequencySummary
|
|
||||||
|
|
||||||
@synthesize unknownYearCount = _unknownYearCount;
|
|
||||||
@synthesize totalCount = _totalCount;
|
|
||||||
@synthesize frequencyString = _frequencyString;
|
|
||||||
@synthesize word = _word;
|
|
||||||
@synthesize frequency = _frequency;
|
|
||||||
- (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
|
|
||||||
{
|
|
||||||
_unknownYearCount = [dict objectForKey:@"unknownYearCount"];
|
|
||||||
_totalCount = [dict objectForKey:@"totalCount"];
|
|
||||||
_frequencyString = [dict objectForKey:@"frequencyString"];
|
|
||||||
_word = [dict objectForKey:@"word"];
|
|
||||||
id frequency_dict = [dict objectForKey:@"frequency"];
|
|
||||||
if([frequency_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)frequency_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)frequency_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)frequency_dict) {
|
|
||||||
NIKFrequency* d = [[NIKFrequency alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_frequency = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_unknownYearCount != nil) [dict setObject:_unknownYearCount forKey:@"unknownYearCount"];
|
|
||||||
if(_totalCount != nil) [dict setObject:_totalCount forKey:@"totalCount"];
|
|
||||||
if(_frequencyString != nil) [dict setObject:_frequencyString forKey:@"frequencyString"];
|
|
||||||
if(_word != nil) [dict setObject:_word forKey:@"word"];
|
|
||||||
if(_frequency != nil){
|
|
||||||
if([_frequency isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKFrequency * frequency in (NSArray*)_frequency) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)frequency asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"frequency"];
|
|
||||||
}
|
|
||||||
else if(_frequency && [_frequency isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_frequency toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"frequency"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_frequency != nil) [dict setObject:[(NIKSwaggerObject*)_frequency asDictionary]forKey:@"frequency"];
|
|
||||||
}
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKLabel : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _text; //NSString
|
|
||||||
NSString* _type; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSString* text;
|
|
||||||
@property(nonatomic) NSString* type;
|
|
||||||
- (id) text: (NSString*) text
|
|
||||||
type: (NSString*) type;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKLabel.h"
|
|
||||||
|
|
||||||
@implementation NIKLabel
|
|
||||||
|
|
||||||
@synthesize text = _text;
|
|
||||||
@synthesize type = _type;
|
|
||||||
- (id) text: (NSString*) text
|
|
||||||
type: (NSString*) type
|
|
||||||
{
|
|
||||||
_text = text;
|
|
||||||
_type = type;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
_text = [dict objectForKey:@"text"];
|
|
||||||
_type = [dict objectForKey:@"type"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_text != nil) [dict setObject:_text forKey:@"text"];
|
|
||||||
if(_type != nil) [dict setObject:_type forKey:@"type"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKNote : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _noteType; //NSString
|
|
||||||
NSArray* _appliesTo; //NSString
|
|
||||||
NSString* _value; //NSString
|
|
||||||
NSNumber* _pos; //NSNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKNote.h"
|
|
||||||
|
|
||||||
@implementation NIKNote
|
|
||||||
|
|
||||||
@synthesize noteType = _noteType;
|
|
||||||
@synthesize appliesTo = _appliesTo;
|
|
||||||
@synthesize value = _value;
|
|
||||||
@synthesize pos = _pos;
|
|
||||||
- (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
|
|
||||||
{
|
|
||||||
_noteType = [dict objectForKey:@"noteType"];
|
|
||||||
_appliesTo = [dict objectForKey:@"appliesTo"];
|
|
||||||
_value = [dict objectForKey:@"value"];
|
|
||||||
_pos = [dict objectForKey:@"pos"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_noteType != nil) [dict setObject:_noteType forKey:@"noteType"];
|
|
||||||
if(_appliesTo != nil) [dict setObject:_appliesTo forKey:@"appliesTo"];
|
|
||||||
if(_value != nil) [dict setObject:_value forKey:@"value"];
|
|
||||||
if(_pos != nil) [dict setObject:_pos forKey:@"pos"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKRelated : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _label1; //NSString
|
|
||||||
NSString* _relationshipType; //NSString
|
|
||||||
NSString* _label2; //NSString
|
|
||||||
NSString* _label3; //NSString
|
|
||||||
NSArray* _words; //NSString
|
|
||||||
NSString* _gram; //NSString
|
|
||||||
NSString* _label4; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKRelated.h"
|
|
||||||
|
|
||||||
@implementation NIKRelated
|
|
||||||
|
|
||||||
@synthesize label1 = _label1;
|
|
||||||
@synthesize relationshipType = _relationshipType;
|
|
||||||
@synthesize label2 = _label2;
|
|
||||||
@synthesize label3 = _label3;
|
|
||||||
@synthesize words = _words;
|
|
||||||
@synthesize gram = _gram;
|
|
||||||
@synthesize label4 = _label4;
|
|
||||||
- (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
|
|
||||||
{
|
|
||||||
_label1 = [dict objectForKey:@"label1"];
|
|
||||||
_relationshipType = [dict objectForKey:@"relationshipType"];
|
|
||||||
_label2 = [dict objectForKey:@"label2"];
|
|
||||||
_label3 = [dict objectForKey:@"label3"];
|
|
||||||
_words = [dict objectForKey:@"words"];
|
|
||||||
_gram = [dict objectForKey:@"gram"];
|
|
||||||
_label4 = [dict objectForKey:@"label4"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_label1 != nil) [dict setObject:_label1 forKey:@"label1"];
|
|
||||||
if(_relationshipType != nil) [dict setObject:_relationshipType forKey:@"relationshipType"];
|
|
||||||
if(_label2 != nil) [dict setObject:_label2 forKey:@"label2"];
|
|
||||||
if(_label3 != nil) [dict setObject:_label3 forKey:@"label3"];
|
|
||||||
if(_words != nil) [dict setObject:_words forKey:@"words"];
|
|
||||||
if(_gram != nil) [dict setObject:_gram forKey:@"gram"];
|
|
||||||
if(_label4 != nil) [dict setObject:_label4 forKey:@"label4"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKScoredWord : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* _position; //NSNumber
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSNumber* _docTermCount; //NSNumber
|
|
||||||
NSString* _lemma; //NSString
|
|
||||||
NSString* _wordType; //NSString
|
|
||||||
NSNumber* _score; //NSNumber
|
|
||||||
NSNumber* _sentenceId; //NSNumber
|
|
||||||
NSString* _word; //NSString
|
|
||||||
NSNumber* _stopword; //NSNumber
|
|
||||||
NSNumber* _baseWordScore; //NSNumber
|
|
||||||
NSString* _partOfSpeech; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKScoredWord.h"
|
|
||||||
|
|
||||||
@implementation NIKScoredWord
|
|
||||||
|
|
||||||
@synthesize position = _position;
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize docTermCount = _docTermCount;
|
|
||||||
@synthesize lemma = _lemma;
|
|
||||||
@synthesize wordType = _wordType;
|
|
||||||
@synthesize score = _score;
|
|
||||||
@synthesize sentenceId = _sentenceId;
|
|
||||||
@synthesize word = _word;
|
|
||||||
@synthesize stopword = _stopword;
|
|
||||||
@synthesize baseWordScore = _baseWordScore;
|
|
||||||
@synthesize partOfSpeech = _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
|
|
||||||
{
|
|
||||||
_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
|
|
||||||
{
|
|
||||||
_position = [dict objectForKey:@"position"];
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
_docTermCount = [dict objectForKey:@"docTermCount"];
|
|
||||||
_lemma = [dict objectForKey:@"lemma"];
|
|
||||||
_wordType = [dict objectForKey:@"wordType"];
|
|
||||||
_score = [dict objectForKey:@"score"];
|
|
||||||
_sentenceId = [dict objectForKey:@"sentenceId"];
|
|
||||||
_word = [dict objectForKey:@"word"];
|
|
||||||
_stopword = [dict objectForKey:@"stopword"];
|
|
||||||
_baseWordScore = [dict objectForKey:@"baseWordScore"];
|
|
||||||
_partOfSpeech = [dict objectForKey:@"partOfSpeech"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_position != nil) [dict setObject:_position forKey:@"position"];
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_docTermCount != nil) [dict setObject:_docTermCount forKey:@"docTermCount"];
|
|
||||||
if(_lemma != nil) [dict setObject:_lemma forKey:@"lemma"];
|
|
||||||
if(_wordType != nil) [dict setObject:_wordType forKey:@"wordType"];
|
|
||||||
if(_score != nil) [dict setObject:_score forKey:@"score"];
|
|
||||||
if(_sentenceId != nil) [dict setObject:_sentenceId forKey:@"sentenceId"];
|
|
||||||
if(_word != nil) [dict setObject:_word forKey:@"word"];
|
|
||||||
if(_stopword != nil) [dict setObject:_stopword forKey:@"stopword"];
|
|
||||||
if(_baseWordScore != nil) [dict setObject:_baseWordScore forKey:@"baseWordScore"];
|
|
||||||
if(_partOfSpeech != nil) [dict setObject:_partOfSpeech forKey:@"partOfSpeech"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKScoredWord.h"
|
|
||||||
|
|
||||||
@interface NIKSentence : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* _hasScoredWords; //NSNumber
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSArray* _scoredWords; //ScoredWord
|
|
||||||
NSString* _display; //NSString
|
|
||||||
NSNumber* _rating; //NSNumber
|
|
||||||
NSNumber* _documentMetadataId; //NSNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKSentence.h"
|
|
||||||
|
|
||||||
@implementation NIKSentence
|
|
||||||
|
|
||||||
@synthesize hasScoredWords = _hasScoredWords;
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize scoredWords = _scoredWords;
|
|
||||||
@synthesize display = _display;
|
|
||||||
@synthesize rating = _rating;
|
|
||||||
@synthesize documentMetadataId = _documentMetadataId;
|
|
||||||
- (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
|
|
||||||
{
|
|
||||||
_hasScoredWords = [dict objectForKey:@"hasScoredWords"];
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
id scoredWords_dict = [dict objectForKey:@"scoredWords"];
|
|
||||||
if([scoredWords_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)scoredWords_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)scoredWords_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)scoredWords_dict) {
|
|
||||||
NIKScoredWord* d = [[NIKScoredWord alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_scoredWords = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_display = [dict objectForKey:@"display"];
|
|
||||||
_rating = [dict objectForKey:@"rating"];
|
|
||||||
_documentMetadataId = [dict objectForKey:@"documentMetadataId"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_hasScoredWords != nil) [dict setObject:_hasScoredWords forKey:@"hasScoredWords"];
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_scoredWords != nil){
|
|
||||||
if([_scoredWords isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKScoredWord * scoredWords in (NSArray*)_scoredWords) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)scoredWords asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"scoredWords"];
|
|
||||||
}
|
|
||||||
else if(_scoredWords && [_scoredWords isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_scoredWords toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"scoredWords"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_scoredWords != nil) [dict setObject:[(NIKSwaggerObject*)_scoredWords asDictionary]forKey:@"scoredWords"];
|
|
||||||
}
|
|
||||||
if(_display != nil) [dict setObject:_display forKey:@"display"];
|
|
||||||
if(_rating != nil) [dict setObject:_rating forKey:@"rating"];
|
|
||||||
if(_documentMetadataId != nil) [dict setObject:_documentMetadataId forKey:@"documentMetadataId"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKSimpleDefinition : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _text; //NSString
|
|
||||||
NSString* _source; //NSString
|
|
||||||
NSString* _note; //NSString
|
|
||||||
NSString* _partOfSpeech; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKSimpleDefinition.h"
|
|
||||||
|
|
||||||
@implementation NIKSimpleDefinition
|
|
||||||
|
|
||||||
@synthesize text = _text;
|
|
||||||
@synthesize source = _source;
|
|
||||||
@synthesize note = _note;
|
|
||||||
@synthesize partOfSpeech = _partOfSpeech;
|
|
||||||
- (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
|
|
||||||
{
|
|
||||||
_text = [dict objectForKey:@"text"];
|
|
||||||
_source = [dict objectForKey:@"source"];
|
|
||||||
_note = [dict objectForKey:@"note"];
|
|
||||||
_partOfSpeech = [dict objectForKey:@"partOfSpeech"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_text != nil) [dict setObject:_text forKey:@"text"];
|
|
||||||
if(_source != nil) [dict setObject:_source forKey:@"source"];
|
|
||||||
if(_note != nil) [dict setObject:_note forKey:@"note"];
|
|
||||||
if(_partOfSpeech != nil) [dict setObject:_partOfSpeech forKey:@"partOfSpeech"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKSimpleExample : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSString* _title; //NSString
|
|
||||||
NSString* _text; //NSString
|
|
||||||
NSString* _url; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKSimpleExample.h"
|
|
||||||
|
|
||||||
@implementation NIKSimpleExample
|
|
||||||
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize title = _title;
|
|
||||||
@synthesize text = _text;
|
|
||||||
@synthesize url = _url;
|
|
||||||
- (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
|
|
||||||
{
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
_title = [dict objectForKey:@"title"];
|
|
||||||
_text = [dict objectForKey:@"text"];
|
|
||||||
_url = [dict objectForKey:@"url"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_title != nil) [dict setObject:_title forKey:@"title"];
|
|
||||||
if(_text != nil) [dict setObject:_text forKey:@"text"];
|
|
||||||
if(_url != nil) [dict setObject:_url forKey:@"url"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKStringValue : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _word; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSString* word;
|
|
||||||
- (id) word: (NSString*) word;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKStringValue.h"
|
|
||||||
|
|
||||||
@implementation NIKStringValue
|
|
||||||
|
|
||||||
@synthesize word = _word;
|
|
||||||
- (id) word: (NSString*) word
|
|
||||||
{
|
|
||||||
_word = word;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
_word = [dict objectForKey:@"word"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_word != nil) [dict setObject:_word forKey:@"word"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
@interface NIKSwaggerObject : NSObject
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
@end
|
|
@ -1,10 +0,0 @@
|
|||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@implementation NIKSwaggerObject
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict {
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
- (NSDictionary*) asDictionary{
|
|
||||||
return [NSDictionary init];
|
|
||||||
}
|
|
||||||
@end
|
|
@ -1,25 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKSyllable : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _text; //NSString
|
|
||||||
NSNumber* _seq; //NSNumber
|
|
||||||
NSString* _type; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKSyllable.h"
|
|
||||||
|
|
||||||
@implementation NIKSyllable
|
|
||||||
|
|
||||||
@synthesize text = _text;
|
|
||||||
@synthesize seq = _seq;
|
|
||||||
@synthesize type = _type;
|
|
||||||
- (id) text: (NSString*) text
|
|
||||||
seq: (NSNumber*) seq
|
|
||||||
type: (NSString*) type
|
|
||||||
{
|
|
||||||
_text = text;
|
|
||||||
_seq = seq;
|
|
||||||
_type = type;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
_text = [dict objectForKey:@"text"];
|
|
||||||
_seq = [dict objectForKey:@"seq"];
|
|
||||||
_type = [dict objectForKey:@"type"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_text != nil) [dict setObject:_text forKey:@"text"];
|
|
||||||
if(_seq != nil) [dict setObject:_seq forKey:@"seq"];
|
|
||||||
if(_type != nil) [dict setObject:_type forKey:@"type"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKTextPron : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSString* _raw; //NSString
|
|
||||||
NSNumber* _seq; //NSNumber
|
|
||||||
NSString* _rawType; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKTextPron.h"
|
|
||||||
|
|
||||||
@implementation NIKTextPron
|
|
||||||
|
|
||||||
@synthesize raw = _raw;
|
|
||||||
@synthesize seq = _seq;
|
|
||||||
@synthesize rawType = _rawType;
|
|
||||||
- (id) raw: (NSString*) raw
|
|
||||||
seq: (NSNumber*) seq
|
|
||||||
rawType: (NSString*) rawType
|
|
||||||
{
|
|
||||||
_raw = raw;
|
|
||||||
_seq = seq;
|
|
||||||
_rawType = rawType;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
_raw = [dict objectForKey:@"raw"];
|
|
||||||
_seq = [dict objectForKey:@"seq"];
|
|
||||||
_rawType = [dict objectForKey:@"rawType"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_raw != nil) [dict setObject:_raw forKey:@"raw"];
|
|
||||||
if(_seq != nil) [dict setObject:_seq forKey:@"seq"];
|
|
||||||
if(_rawType != nil) [dict setObject:_rawType forKey:@"rawType"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKUser : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSString* _username; //NSString
|
|
||||||
NSString* _email; //NSString
|
|
||||||
NSNumber* _status; //NSNumber
|
|
||||||
NSString* _faceBookId; //NSString
|
|
||||||
NSString* _userName; //NSString
|
|
||||||
NSString* _displayName; //NSString
|
|
||||||
NSString* _password; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKUser.h"
|
|
||||||
|
|
||||||
@implementation NIKUser
|
|
||||||
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize username = _username;
|
|
||||||
@synthesize email = _email;
|
|
||||||
@synthesize status = _status;
|
|
||||||
@synthesize faceBookId = _faceBookId;
|
|
||||||
@synthesize userName = _userName;
|
|
||||||
@synthesize displayName = _displayName;
|
|
||||||
@synthesize password = _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 = _id;
|
|
||||||
_username = username;
|
|
||||||
_email = email;
|
|
||||||
_status = status;
|
|
||||||
_faceBookId = faceBookId;
|
|
||||||
_userName = userName;
|
|
||||||
_displayName = displayName;
|
|
||||||
_password = password;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
_username = [dict objectForKey:@"username"];
|
|
||||||
_email = [dict objectForKey:@"email"];
|
|
||||||
_status = [dict objectForKey:@"status"];
|
|
||||||
_faceBookId = [dict objectForKey:@"faceBookId"];
|
|
||||||
_userName = [dict objectForKey:@"userName"];
|
|
||||||
_displayName = [dict objectForKey:@"displayName"];
|
|
||||||
_password = [dict objectForKey:@"password"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_username != nil) [dict setObject:_username forKey:@"username"];
|
|
||||||
if(_email != nil) [dict setObject:_email forKey:@"email"];
|
|
||||||
if(_status != nil) [dict setObject:_status forKey:@"status"];
|
|
||||||
if(_faceBookId != nil) [dict setObject:_faceBookId forKey:@"faceBookId"];
|
|
||||||
if(_userName != nil) [dict setObject:_userName forKey:@"userName"];
|
|
||||||
if(_displayName != nil) [dict setObject:_displayName forKey:@"displayName"];
|
|
||||||
if(_password != nil) [dict setObject:_password forKey:@"password"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKApiInvoker.h"
|
|
||||||
#import "NIKDefinition.h"
|
|
||||||
#import "NIKTextPron.h"
|
|
||||||
#import "NIKExample.h"
|
|
||||||
#import "NIKSyllable.h"
|
|
||||||
#import "NIKAudioFile.h"
|
|
||||||
#import "NIKExampleSearchResults.h"
|
|
||||||
#import "NIKWordObject.h"
|
|
||||||
#import "NIKBigram.h"
|
|
||||||
#import "NIKRelated.h"
|
|
||||||
#import "NIKFrequencySummary.h"
|
|
||||||
|
|
||||||
|
|
||||||
@interface NIKWordApi: NSObject {
|
|
||||||
|
|
||||||
@private
|
|
||||||
NSOperationQueue *_queue;
|
|
||||||
NIKApiInvoker * _api;
|
|
||||||
}
|
|
||||||
@property(nonatomic, readonly) NSOperationQueue* queue;
|
|
||||||
@property(nonatomic, readonly) NIKApiInvoker* api;
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key;
|
|
||||||
|
|
||||||
-(void) getExamplesWithCompletionBlock :(NSString*) word includeDuplicates:(NSString*) includeDuplicates useCanonical:(NSString*) useCanonical skip:(NSNumber*) skip limit:(NSNumber*) limit
|
|
||||||
completionHandler:(void (^)(NIKExampleSearchResults*, NSError *))completionBlock;
|
|
||||||
-(void) getWordWithCompletionBlock :(NSString*) word useCanonical:(NSString*) useCanonical includeSuggestions:(NSString*) includeSuggestions
|
|
||||||
completionHandler:(void (^)(NIKWordObject*, NSError *))completionBlock;
|
|
||||||
-(void) getDefinitionsWithCompletionBlock :(NSString*) word partOfSpeech:(NSString*) partOfSpeech sourceDictionaries:(NSString*) sourceDictionaries limit:(NSNumber*) limit includeRelated:(NSString*) includeRelated useCanonical:(NSString*) useCanonical includeTags:(NSString*) includeTags
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock;
|
|
||||||
-(void) getTopExampleWithCompletionBlock :(NSString*) word useCanonical:(NSString*) useCanonical
|
|
||||||
completionHandler:(void (^)(NIKExample*, NSError *))completionBlock;
|
|
||||||
-(void) getRelatedWordsWithCompletionBlock :(NSString*) word relationshipTypes:(NSString*) relationshipTypes useCanonical:(NSString*) useCanonical limitPerRelationshipType:(NSNumber*) limitPerRelationshipType
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock;
|
|
||||||
-(void) getTextPronunciationsWithCompletionBlock :(NSString*) word sourceDictionary:(NSString*) sourceDictionary typeFormat:(NSString*) typeFormat useCanonical:(NSString*) useCanonical limit:(NSNumber*) limit
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock;
|
|
||||||
-(void) getHyphenationWithCompletionBlock :(NSString*) word sourceDictionary:(NSString*) sourceDictionary useCanonical:(NSString*) useCanonical limit:(NSNumber*) limit
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock;
|
|
||||||
-(void) getWordFrequencyWithCompletionBlock :(NSString*) word useCanonical:(NSString*) useCanonical startYear:(NSNumber*) startYear endYear:(NSNumber*) endYear
|
|
||||||
completionHandler:(void (^)(NIKFrequencySummary*, NSError *))completionBlock;
|
|
||||||
-(void) getPhrasesWithCompletionBlock :(NSString*) word limit:(NSNumber*) limit wlmi:(NSNumber*) wlmi useCanonical:(NSString*) useCanonical
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock;
|
|
||||||
-(void) getEtymologiesWithCompletionBlock :(NSString*) word useCanonical:(NSString*) useCanonical
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock;
|
|
||||||
-(void) getAudioWithCompletionBlock :(NSString*) word useCanonical:(NSString*) useCanonical limit:(NSNumber*) limit
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock;
|
|
||||||
@end
|
|
File diff suppressed because it is too large
Load Diff
@ -1,50 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKDate.h"
|
|
||||||
|
|
||||||
@interface NIKWordList : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NIKDate* _updatedAt; //NIKDate
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSString* _username; //NSString
|
|
||||||
NSString* _permalink; //NSString
|
|
||||||
NIKDate* _lastActivityAt; //NIKDate
|
|
||||||
NIKDate* _createdAt; //NIKDate
|
|
||||||
NSString* _description; //NSString
|
|
||||||
NSNumber* _userId; //NSNumber
|
|
||||||
NSString* _name; //NSString
|
|
||||||
NSNumber* _numberWordsInList; //NSNumber
|
|
||||||
NSString* _type; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NIKDate* updatedAt;
|
|
||||||
@property(nonatomic) NSNumber* _id;
|
|
||||||
@property(nonatomic) NSString* username;
|
|
||||||
@property(nonatomic) NSString* permalink;
|
|
||||||
@property(nonatomic) NIKDate* lastActivityAt;
|
|
||||||
@property(nonatomic) NIKDate* createdAt;
|
|
||||||
@property(nonatomic) NSString* description;
|
|
||||||
@property(nonatomic) NSNumber* userId;
|
|
||||||
@property(nonatomic) NSString* name;
|
|
||||||
@property(nonatomic) NSNumber* numberWordsInList;
|
|
||||||
@property(nonatomic) NSString* type;
|
|
||||||
- (id) updatedAt: (NIKDate*) updatedAt
|
|
||||||
_id: (NSNumber*) _id
|
|
||||||
username: (NSString*) username
|
|
||||||
permalink: (NSString*) permalink
|
|
||||||
lastActivityAt: (NIKDate*) lastActivityAt
|
|
||||||
createdAt: (NIKDate*) createdAt
|
|
||||||
description: (NSString*) description
|
|
||||||
userId: (NSNumber*) userId
|
|
||||||
name: (NSString*) name
|
|
||||||
numberWordsInList: (NSNumber*) numberWordsInList
|
|
||||||
type: (NSString*) type;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,131 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKWordList.h"
|
|
||||||
|
|
||||||
@implementation NIKWordList
|
|
||||||
|
|
||||||
@synthesize updatedAt = _updatedAt;
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize username = _username;
|
|
||||||
@synthesize permalink = _permalink;
|
|
||||||
@synthesize lastActivityAt = _lastActivityAt;
|
|
||||||
@synthesize createdAt = _createdAt;
|
|
||||||
@synthesize description = _description;
|
|
||||||
@synthesize userId = _userId;
|
|
||||||
@synthesize name = _name;
|
|
||||||
@synthesize numberWordsInList = _numberWordsInList;
|
|
||||||
@synthesize type = _type;
|
|
||||||
- (id) updatedAt: (NIKDate*) updatedAt
|
|
||||||
_id: (NSNumber*) _id
|
|
||||||
username: (NSString*) username
|
|
||||||
permalink: (NSString*) permalink
|
|
||||||
lastActivityAt: (NIKDate*) lastActivityAt
|
|
||||||
createdAt: (NIKDate*) createdAt
|
|
||||||
description: (NSString*) description
|
|
||||||
userId: (NSNumber*) userId
|
|
||||||
name: (NSString*) name
|
|
||||||
numberWordsInList: (NSNumber*) numberWordsInList
|
|
||||||
type: (NSString*) type
|
|
||||||
{
|
|
||||||
_updatedAt = updatedAt;
|
|
||||||
__id = _id;
|
|
||||||
_username = username;
|
|
||||||
_permalink = permalink;
|
|
||||||
_lastActivityAt = lastActivityAt;
|
|
||||||
_createdAt = createdAt;
|
|
||||||
_description = description;
|
|
||||||
_userId = userId;
|
|
||||||
_name = name;
|
|
||||||
_numberWordsInList = numberWordsInList;
|
|
||||||
_type = type;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
id updatedAt_dict = [dict objectForKey:@"updatedAt"];
|
|
||||||
_updatedAt = [[NIKDate alloc]initWithValues:updatedAt_dict];
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
_username = [dict objectForKey:@"username"];
|
|
||||||
_permalink = [dict objectForKey:@"permalink"];
|
|
||||||
id lastActivityAt_dict = [dict objectForKey:@"lastActivityAt"];
|
|
||||||
_lastActivityAt = [[NIKDate alloc]initWithValues:lastActivityAt_dict];
|
|
||||||
id createdAt_dict = [dict objectForKey:@"createdAt"];
|
|
||||||
_createdAt = [[NIKDate alloc]initWithValues:createdAt_dict];
|
|
||||||
_description = [dict objectForKey:@"description"];
|
|
||||||
_userId = [dict objectForKey:@"userId"];
|
|
||||||
_name = [dict objectForKey:@"name"];
|
|
||||||
_numberWordsInList = [dict objectForKey:@"numberWordsInList"];
|
|
||||||
_type = [dict objectForKey:@"type"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_updatedAt != nil){
|
|
||||||
if([_updatedAt isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKDate * updatedAt in (NSArray*)_updatedAt) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)updatedAt asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"updatedAt"];
|
|
||||||
}
|
|
||||||
else if(_updatedAt && [_updatedAt isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_updatedAt toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"updatedAt"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_updatedAt != nil) [dict setObject:[(NIKSwaggerObject*)_updatedAt asDictionary]forKey:@"updatedAt"];
|
|
||||||
}
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_username != nil) [dict setObject:_username forKey:@"username"];
|
|
||||||
if(_permalink != nil) [dict setObject:_permalink forKey:@"permalink"];
|
|
||||||
if(_lastActivityAt != nil){
|
|
||||||
if([_lastActivityAt isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKDate * lastActivityAt in (NSArray*)_lastActivityAt) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)lastActivityAt asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"lastActivityAt"];
|
|
||||||
}
|
|
||||||
else if(_lastActivityAt && [_lastActivityAt isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_lastActivityAt toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"lastActivityAt"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_lastActivityAt != nil) [dict setObject:[(NIKSwaggerObject*)_lastActivityAt asDictionary]forKey:@"lastActivityAt"];
|
|
||||||
}
|
|
||||||
if(_createdAt != nil){
|
|
||||||
if([_createdAt isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKDate * createdAt in (NSArray*)_createdAt) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)createdAt asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
else if(_createdAt && [_createdAt isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_createdAt toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_createdAt != nil) [dict setObject:[(NIKSwaggerObject*)_createdAt asDictionary]forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
if(_description != nil) [dict setObject:_description forKey:@"description"];
|
|
||||||
if(_userId != nil) [dict setObject:_userId forKey:@"userId"];
|
|
||||||
if(_name != nil) [dict setObject:_name forKey:@"name"];
|
|
||||||
if(_numberWordsInList != nil) [dict setObject:_numberWordsInList forKey:@"numberWordsInList"];
|
|
||||||
if(_type != nil) [dict setObject:_type forKey:@"type"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKApiInvoker.h"
|
|
||||||
#import "NIKWordList.h"
|
|
||||||
#import "NIKStringValue.h"
|
|
||||||
#import "NIKWordListWord.h"
|
|
||||||
|
|
||||||
|
|
||||||
@interface NIKWordListApi: NSObject {
|
|
||||||
|
|
||||||
@private
|
|
||||||
NSOperationQueue *_queue;
|
|
||||||
NIKApiInvoker * _api;
|
|
||||||
}
|
|
||||||
@property(nonatomic, readonly) NSOperationQueue* queue;
|
|
||||||
@property(nonatomic, readonly) NIKApiInvoker* api;
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key;
|
|
||||||
|
|
||||||
-(void) updateWordListWithCompletionBlock :(NSString*) permalink body:(NIKWordList*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))completionBlock;
|
|
||||||
-(void) deleteWordListWithCompletionBlock :(NSString*) permalink auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))completionBlock;
|
|
||||||
-(void) getWordListByPermalinkWithCompletionBlock :(NSString*) permalink auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NIKWordList*, NSError *))completionBlock;
|
|
||||||
-(void) addWordsToWordListWithCompletionBlock :(NSString*) permalink body:(NSArray*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))completionBlock;
|
|
||||||
-(void) getWordListWordsWithCompletionBlock :(NSString*) permalink auth_token:(NSString*) auth_token sortBy:(NSString*) sortBy sortOrder:(NSString*) sortOrder skip:(NSNumber*) skip limit:(NSNumber*) limit
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))completionBlock;
|
|
||||||
-(void) deleteWordsFromWordListWithCompletionBlock :(NSString*) permalink body:(NSArray*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))completionBlock;
|
|
||||||
@end
|
|
@ -1,678 +0,0 @@
|
|||||||
#import "NIKWordListApi.h"
|
|
||||||
#import "NIKWordList.h"
|
|
||||||
#import "NIKStringValue.h"
|
|
||||||
#import "NIKWordListWord.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation NIKWordListApi
|
|
||||||
static NSString * basePath = @"http://api.wordnik.com/v4";
|
|
||||||
|
|
||||||
@synthesize queue = _queue;
|
|
||||||
@synthesize api = _api;
|
|
||||||
|
|
||||||
- (id) init {
|
|
||||||
self = [super init];
|
|
||||||
_queue = [[NSOperationQueue alloc] init];
|
|
||||||
_api = [[NIKApiInvoker alloc] init];
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key {
|
|
||||||
[_api addHeader:value forKey:key];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive: true
|
|
||||||
* returnBaseType:
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) updateWordListWithCompletionBlock :(NSString*) permalink body:(NIKWordList*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))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: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"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:[(NIKSwaggerObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(NIKSwaggerObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api stringWithCompletionBlock: requestUrl
|
|
||||||
method: @"PUT"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSString *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive: true
|
|
||||||
* returnBaseType:
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) deleteWordListWithCompletionBlock :(NSString*) permalink auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))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: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"auth_token"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api stringWithCompletionBlock: requestUrl
|
|
||||||
method: @"DELETE"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSString *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKWordList
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) getWordListByPermalinkWithCompletionBlock :(NSString*) permalink auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NIKWordList*, NSError *))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: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"auth_token"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock( [[NIKWordList alloc]initWithValues: data], nil);}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive: true
|
|
||||||
* returnBaseType:
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) addWordsToWordListWithCompletionBlock :(NSString*) permalink body:(NSArray*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))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: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"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:[(NIKSwaggerObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(NIKSwaggerObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api stringWithCompletionBlock: requestUrl
|
|
||||||
method: @"POST"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSString *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKWordListWord
|
|
||||||
* returnContainer: List
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) getWordListWordsWithCompletionBlock :(NSString*) permalink auth_token:(NSString*) auth_token sortBy:(NSString*) sortBy sortOrder:(NSString*) sortOrder skip:(NSNumber*) skip limit:(NSNumber*) limit
|
|
||||||
completionHandler:(void (^)(NSArray*, NSError *))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: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(sortBy != nil)
|
|
||||||
[queryParams setValue:sortBy forKey:@"sortBy"];
|
|
||||||
if(sortOrder != nil)
|
|
||||||
[queryParams setValue:sortOrder forKey:@"sortOrder"];
|
|
||||||
if(skip != nil)
|
|
||||||
[queryParams setValue:skip forKey:@"skip"];
|
|
||||||
if(limit != nil)
|
|
||||||
[queryParams setValue:limit forKey:@"limit"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"auth_token"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(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) {
|
|
||||||
NIKWordListWord* d = [[NIKWordListWord alloc]initWithValues: dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
completionBlock(objs, nil);
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive: true
|
|
||||||
* returnBaseType:
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) deleteWordsFromWordListWithCompletionBlock :(NSString*) permalink body:(NSArray*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))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: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"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:[(NIKSwaggerObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(NIKSwaggerObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api stringWithCompletionBlock: requestUrl
|
|
||||||
method: @"POST"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSString *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) updateWordListAsJsonWithCompletionBlock :(NSString*) permalink body:(NIKWordList*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))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:@""];
|
|
||||||
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"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:[(NIKSwaggerObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(NIKSwaggerObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"PUT"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) deleteWordListAsJsonWithCompletionBlock :(NSString*) permalink auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))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:@""];
|
|
||||||
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"auth_token"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"DELETE"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) getWordListByPermalinkAsJsonWithCompletionBlock :(NSString*) permalink auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"auth_token"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) addWordsToWordListAsJsonWithCompletionBlock :(NSString*) permalink body:(NSArray*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))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:@""];
|
|
||||||
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"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:[(NIKSwaggerObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(NIKSwaggerObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"POST"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) getWordListWordsAsJsonWithCompletionBlock :(NSString*) permalink auth_token:(NSString*) auth_token sortBy:(NSString*) sortBy sortOrder:(NSString*) sortOrder skip:(NSNumber*) skip limit:(NSNumber*) limit
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(sortBy != nil)
|
|
||||||
[queryParams setValue:sortBy forKey:@"sortBy"];
|
|
||||||
if(sortOrder != nil)
|
|
||||||
[queryParams setValue:sortOrder forKey:@"sortOrder"];
|
|
||||||
if(skip != nil)
|
|
||||||
[queryParams setValue:skip forKey:@"skip"];
|
|
||||||
if(limit != nil)
|
|
||||||
[queryParams setValue:limit forKey:@"limit"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"auth_token"];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) deleteWordsFromWordListAsJsonWithCompletionBlock :(NSString*) permalink body:(NSArray*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSError *))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:@""];
|
|
||||||
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"permalink", @"}"]] withString: [_api escapeString:permalink]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"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:[(NIKSwaggerObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(NIKSwaggerObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(permalink == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"POST"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock(nil);
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
@ -1,38 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKDate.h"
|
|
||||||
|
|
||||||
@interface NIKWordListWord : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSString* _username; //NSString
|
|
||||||
NIKDate* _createdAt; //NIKDate
|
|
||||||
NSNumber* _numberCommentsOnWord; //NSNumber
|
|
||||||
NSNumber* _userId; //NSNumber
|
|
||||||
NSString* _word; //NSString
|
|
||||||
NSNumber* _numberLists; //NSNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* _id;
|
|
||||||
@property(nonatomic) NSString* username;
|
|
||||||
@property(nonatomic) NIKDate* createdAt;
|
|
||||||
@property(nonatomic) NSNumber* numberCommentsOnWord;
|
|
||||||
@property(nonatomic) NSNumber* userId;
|
|
||||||
@property(nonatomic) NSString* word;
|
|
||||||
@property(nonatomic) NSNumber* numberLists;
|
|
||||||
- (id) _id: (NSNumber*) _id
|
|
||||||
username: (NSString*) username
|
|
||||||
createdAt: (NIKDate*) createdAt
|
|
||||||
numberCommentsOnWord: (NSNumber*) numberCommentsOnWord
|
|
||||||
userId: (NSNumber*) userId
|
|
||||||
word: (NSString*) word
|
|
||||||
numberLists: (NSNumber*) numberLists;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKWordListWord.h"
|
|
||||||
|
|
||||||
@implementation NIKWordListWord
|
|
||||||
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize username = _username;
|
|
||||||
@synthesize createdAt = _createdAt;
|
|
||||||
@synthesize numberCommentsOnWord = _numberCommentsOnWord;
|
|
||||||
@synthesize userId = _userId;
|
|
||||||
@synthesize word = _word;
|
|
||||||
@synthesize numberLists = _numberLists;
|
|
||||||
- (id) _id: (NSNumber*) _id
|
|
||||||
username: (NSString*) username
|
|
||||||
createdAt: (NIKDate*) createdAt
|
|
||||||
numberCommentsOnWord: (NSNumber*) numberCommentsOnWord
|
|
||||||
userId: (NSNumber*) userId
|
|
||||||
word: (NSString*) word
|
|
||||||
numberLists: (NSNumber*) numberLists
|
|
||||||
{
|
|
||||||
__id = _id;
|
|
||||||
_username = username;
|
|
||||||
_createdAt = createdAt;
|
|
||||||
_numberCommentsOnWord = numberCommentsOnWord;
|
|
||||||
_userId = userId;
|
|
||||||
_word = word;
|
|
||||||
_numberLists = numberLists;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
_username = [dict objectForKey:@"username"];
|
|
||||||
id createdAt_dict = [dict objectForKey:@"createdAt"];
|
|
||||||
_createdAt = [[NIKDate alloc]initWithValues:createdAt_dict];
|
|
||||||
_numberCommentsOnWord = [dict objectForKey:@"numberCommentsOnWord"];
|
|
||||||
_userId = [dict objectForKey:@"userId"];
|
|
||||||
_word = [dict objectForKey:@"word"];
|
|
||||||
_numberLists = [dict objectForKey:@"numberLists"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_username != nil) [dict setObject:_username forKey:@"username"];
|
|
||||||
if(_createdAt != nil){
|
|
||||||
if([_createdAt isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKDate * createdAt in (NSArray*)_createdAt) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)createdAt asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
else if(_createdAt && [_createdAt isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_createdAt toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_createdAt != nil) [dict setObject:[(NIKSwaggerObject*)_createdAt asDictionary]forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
if(_numberCommentsOnWord != nil) [dict setObject:_numberCommentsOnWord forKey:@"numberCommentsOnWord"];
|
|
||||||
if(_userId != nil) [dict setObject:_userId forKey:@"userId"];
|
|
||||||
if(_word != nil) [dict setObject:_word forKey:@"word"];
|
|
||||||
if(_numberLists != nil) [dict setObject:_numberLists forKey:@"numberLists"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKApiInvoker.h"
|
|
||||||
#import "NIKWordList.h"
|
|
||||||
|
|
||||||
|
|
||||||
@interface NIKWordListsApi: NSObject {
|
|
||||||
|
|
||||||
@private
|
|
||||||
NSOperationQueue *_queue;
|
|
||||||
NIKApiInvoker * _api;
|
|
||||||
}
|
|
||||||
@property(nonatomic, readonly) NSOperationQueue* queue;
|
|
||||||
@property(nonatomic, readonly) NIKApiInvoker* api;
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key;
|
|
||||||
|
|
||||||
-(void) createWordListWithCompletionBlock :(NIKWordList*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NIKWordList*, NSError *))completionBlock;
|
|
||||||
@end
|
|
@ -1,151 +0,0 @@
|
|||||||
#import "NIKWordListsApi.h"
|
|
||||||
#import "NIKWordList.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation NIKWordListsApi
|
|
||||||
static NSString * basePath = @"http://api.wordnik.com/v4";
|
|
||||||
|
|
||||||
@synthesize queue = _queue;
|
|
||||||
@synthesize api = _api;
|
|
||||||
|
|
||||||
- (id) init {
|
|
||||||
self = [super init];
|
|
||||||
_queue = [[NSOperationQueue alloc] init];
|
|
||||||
_api = [[NIKApiInvoker alloc] init];
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key {
|
|
||||||
[_api addHeader:value forKey:key];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKWordList
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) createWordListWithCompletionBlock :(NIKWordList*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NIKWordList*, NSError *))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"];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"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:[(NIKSwaggerObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(NIKSwaggerObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"POST"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock( [[NIKWordList alloc]initWithValues: data], nil);}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) createWordListAsJsonWithCompletionBlock :(NIKWordList*) body auth_token:(NSString*) auth_token
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(auth_token != nil)
|
|
||||||
[headerParams setValue:auth_token forKey:@"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:[(NIKSwaggerObject*)dict asDictionary]];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
[objs addObject:dict];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bodyDictionary = objs;
|
|
||||||
}
|
|
||||||
else if([body respondsToSelector:@selector(asDictionary)]) {
|
|
||||||
bodyDictionary = [(NIKSwaggerObject*)body asDictionary];
|
|
||||||
}
|
|
||||||
else if([body isKindOfClass:[NSString class]]) {
|
|
||||||
bodyDictionary = body;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
NSLog(@"don't know what to do with %@", body);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(auth_token == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"POST"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
@ -1,34 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKWordObject : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSString* _word; //NSString
|
|
||||||
NSString* _originalWord; //NSString
|
|
||||||
NSArray* _suggestions; //NSString
|
|
||||||
NSString* _canonicalForm; //NSString
|
|
||||||
NSString* _vulgar; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKWordObject.h"
|
|
||||||
|
|
||||||
@implementation NIKWordObject
|
|
||||||
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize word = _word;
|
|
||||||
@synthesize originalWord = _originalWord;
|
|
||||||
@synthesize suggestions = _suggestions;
|
|
||||||
@synthesize canonicalForm = _canonicalForm;
|
|
||||||
@synthesize vulgar = _vulgar;
|
|
||||||
- (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
|
|
||||||
{
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
_word = [dict objectForKey:@"word"];
|
|
||||||
_originalWord = [dict objectForKey:@"originalWord"];
|
|
||||||
_suggestions = [dict objectForKey:@"suggestions"];
|
|
||||||
_canonicalForm = [dict objectForKey:@"canonicalForm"];
|
|
||||||
_vulgar = [dict objectForKey:@"vulgar"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_word != nil) [dict setObject:_word forKey:@"word"];
|
|
||||||
if(_originalWord != nil) [dict setObject:_originalWord forKey:@"originalWord"];
|
|
||||||
if(_suggestions != nil) [dict setObject:_suggestions forKey:@"suggestions"];
|
|
||||||
if(_canonicalForm != nil) [dict setObject:_canonicalForm forKey:@"canonicalForm"];
|
|
||||||
if(_vulgar != nil) [dict setObject:_vulgar forKey:@"vulgar"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKSimpleDefinition.h"
|
|
||||||
#import "NIKSimpleExample.h"
|
|
||||||
#import "NIKContentProvider.h"
|
|
||||||
|
|
||||||
@interface NIKWordOfTheDay : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* __id; //NSNumber
|
|
||||||
NSString* _parentId; //NSString
|
|
||||||
NSString* _category; //NSString
|
|
||||||
NSString* _createdBy; //NSString
|
|
||||||
NIKDate* _createdAt; //NIKDate
|
|
||||||
NIKContentProvider* _contentProvider; //ContentProvider
|
|
||||||
NSString* _htmlExtra; //NSString
|
|
||||||
NSString* _word; //NSString
|
|
||||||
NSArray* _definitions; //SimpleDefinition
|
|
||||||
NSArray* _examples; //SimpleExample
|
|
||||||
NSString* _note; //NSString
|
|
||||||
NIKDate* _publishDate; //NIKDate
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSNumber* _id;
|
|
||||||
@property(nonatomic) NSString* parentId;
|
|
||||||
@property(nonatomic) NSString* category;
|
|
||||||
@property(nonatomic) NSString* createdBy;
|
|
||||||
@property(nonatomic) NIKDate* createdAt;
|
|
||||||
@property(nonatomic) NIKContentProvider* contentProvider;
|
|
||||||
@property(nonatomic) NSString* htmlExtra;
|
|
||||||
@property(nonatomic) NSString* word;
|
|
||||||
@property(nonatomic) NSArray* definitions;
|
|
||||||
@property(nonatomic) NSArray* examples;
|
|
||||||
@property(nonatomic) NSString* note;
|
|
||||||
@property(nonatomic) NIKDate* publishDate;
|
|
||||||
- (id) _id: (NSNumber*) _id
|
|
||||||
parentId: (NSString*) parentId
|
|
||||||
category: (NSString*) category
|
|
||||||
createdBy: (NSString*) createdBy
|
|
||||||
createdAt: (NIKDate*) createdAt
|
|
||||||
contentProvider: (NIKContentProvider*) contentProvider
|
|
||||||
htmlExtra: (NSString*) htmlExtra
|
|
||||||
word: (NSString*) word
|
|
||||||
definitions: (NSArray*) definitions
|
|
||||||
examples: (NSArray*) examples
|
|
||||||
note: (NSString*) note
|
|
||||||
publishDate: (NIKDate*) publishDate;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,190 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKWordOfTheDay.h"
|
|
||||||
|
|
||||||
@implementation NIKWordOfTheDay
|
|
||||||
|
|
||||||
@synthesize _id = __id;
|
|
||||||
@synthesize parentId = _parentId;
|
|
||||||
@synthesize category = _category;
|
|
||||||
@synthesize createdBy = _createdBy;
|
|
||||||
@synthesize createdAt = _createdAt;
|
|
||||||
@synthesize contentProvider = _contentProvider;
|
|
||||||
@synthesize htmlExtra = _htmlExtra;
|
|
||||||
@synthesize word = _word;
|
|
||||||
@synthesize definitions = _definitions;
|
|
||||||
@synthesize examples = _examples;
|
|
||||||
@synthesize note = _note;
|
|
||||||
@synthesize publishDate = _publishDate;
|
|
||||||
- (id) _id: (NSNumber*) _id
|
|
||||||
parentId: (NSString*) parentId
|
|
||||||
category: (NSString*) category
|
|
||||||
createdBy: (NSString*) createdBy
|
|
||||||
createdAt: (NIKDate*) createdAt
|
|
||||||
contentProvider: (NIKContentProvider*) contentProvider
|
|
||||||
htmlExtra: (NSString*) htmlExtra
|
|
||||||
word: (NSString*) word
|
|
||||||
definitions: (NSArray*) definitions
|
|
||||||
examples: (NSArray*) examples
|
|
||||||
note: (NSString*) note
|
|
||||||
publishDate: (NIKDate*) 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
|
|
||||||
{
|
|
||||||
__id = [dict objectForKey:@"id"];
|
|
||||||
_parentId = [dict objectForKey:@"parentId"];
|
|
||||||
_category = [dict objectForKey:@"category"];
|
|
||||||
_createdBy = [dict objectForKey:@"createdBy"];
|
|
||||||
id createdAt_dict = [dict objectForKey:@"createdAt"];
|
|
||||||
_createdAt = [[NIKDate alloc]initWithValues:createdAt_dict];
|
|
||||||
id contentProvider_dict = [dict objectForKey:@"contentProvider"];
|
|
||||||
_contentProvider = [[NIKContentProvider alloc]initWithValues:contentProvider_dict];
|
|
||||||
_htmlExtra = [dict objectForKey:@"htmlExtra"];
|
|
||||||
_word = [dict objectForKey:@"word"];
|
|
||||||
id definitions_dict = [dict objectForKey:@"definitions"];
|
|
||||||
if([definitions_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)definitions_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)definitions_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)definitions_dict) {
|
|
||||||
NIKSimpleDefinition* d = [[NIKSimpleDefinition alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_definitions = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
id examples_dict = [dict objectForKey:@"examples"];
|
|
||||||
if([examples_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)examples_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)examples_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)examples_dict) {
|
|
||||||
NIKSimpleExample* d = [[NIKSimpleExample alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_examples = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_note = [dict objectForKey:@"note"];
|
|
||||||
id publishDate_dict = [dict objectForKey:@"publishDate"];
|
|
||||||
_publishDate = [[NIKDate alloc]initWithValues:publishDate_dict];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(__id != nil) [dict setObject:__id forKey:@"id"];
|
|
||||||
if(_parentId != nil) [dict setObject:_parentId forKey:@"parentId"];
|
|
||||||
if(_category != nil) [dict setObject:_category forKey:@"category"];
|
|
||||||
if(_createdBy != nil) [dict setObject:_createdBy forKey:@"createdBy"];
|
|
||||||
if(_createdAt != nil){
|
|
||||||
if([_createdAt isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKDate * createdAt in (NSArray*)_createdAt) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)createdAt asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
else if(_createdAt && [_createdAt isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_createdAt toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_createdAt != nil) [dict setObject:[(NIKSwaggerObject*)_createdAt asDictionary]forKey:@"createdAt"];
|
|
||||||
}
|
|
||||||
if(_contentProvider != nil){
|
|
||||||
if([_contentProvider isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKContentProvider * contentProvider in (NSArray*)_contentProvider) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)contentProvider asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"contentProvider"];
|
|
||||||
}
|
|
||||||
else if(_contentProvider && [_contentProvider isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_contentProvider toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"contentProvider"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_contentProvider != nil) [dict setObject:[(NIKSwaggerObject*)_contentProvider asDictionary]forKey:@"contentProvider"];
|
|
||||||
}
|
|
||||||
if(_htmlExtra != nil) [dict setObject:_htmlExtra forKey:@"htmlExtra"];
|
|
||||||
if(_word != nil) [dict setObject:_word forKey:@"word"];
|
|
||||||
if(_definitions != nil){
|
|
||||||
if([_definitions isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKSimpleDefinition * definitions in (NSArray*)_definitions) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)definitions asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"definitions"];
|
|
||||||
}
|
|
||||||
else if(_definitions && [_definitions isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_definitions toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"definitions"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_definitions != nil) [dict setObject:[(NIKSwaggerObject*)_definitions asDictionary]forKey:@"definitions"];
|
|
||||||
}
|
|
||||||
if(_examples != nil){
|
|
||||||
if([_examples isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKSimpleExample * examples in (NSArray*)_examples) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)examples asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"examples"];
|
|
||||||
}
|
|
||||||
else if(_examples && [_examples isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_examples toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"examples"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_examples != nil) [dict setObject:[(NIKSwaggerObject*)_examples asDictionary]forKey:@"examples"];
|
|
||||||
}
|
|
||||||
if(_note != nil) [dict setObject:_note forKey:@"note"];
|
|
||||||
if(_publishDate != nil){
|
|
||||||
if([_publishDate isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKDate * publishDate in (NSArray*)_publishDate) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)publishDate asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"publishDate"];
|
|
||||||
}
|
|
||||||
else if(_publishDate && [_publishDate isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_publishDate toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"publishDate"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_publishDate != nil) [dict setObject:[(NIKSwaggerObject*)_publishDate asDictionary]forKey:@"publishDate"];
|
|
||||||
}
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
|
|
||||||
@interface NIKWordSearchResult : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSNumber* _count; //NSNumber
|
|
||||||
NSNumber* _lexicality; //NSNumber
|
|
||||||
NSString* _word; //NSString
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKWordSearchResult.h"
|
|
||||||
|
|
||||||
@implementation NIKWordSearchResult
|
|
||||||
|
|
||||||
@synthesize count = _count;
|
|
||||||
@synthesize lexicality = _lexicality;
|
|
||||||
@synthesize word = _word;
|
|
||||||
- (id) count: (NSNumber*) count
|
|
||||||
lexicality: (NSNumber*) lexicality
|
|
||||||
word: (NSString*) word
|
|
||||||
{
|
|
||||||
_count = count;
|
|
||||||
_lexicality = lexicality;
|
|
||||||
_word = word;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
_count = [dict objectForKey:@"count"];
|
|
||||||
_lexicality = [dict objectForKey:@"lexicality"];
|
|
||||||
_word = [dict objectForKey:@"word"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_count != nil) [dict setObject:_count forKey:@"count"];
|
|
||||||
if(_lexicality != nil) [dict setObject:_lexicality forKey:@"lexicality"];
|
|
||||||
if(_word != nil) [dict setObject:_word forKey:@"word"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKSwaggerObject.h"
|
|
||||||
#import "NIKWordSearchResult.h"
|
|
||||||
|
|
||||||
@interface NIKWordSearchResults : NIKSwaggerObject {
|
|
||||||
@private
|
|
||||||
NSArray* _searchResults; //WordSearchResult
|
|
||||||
NSNumber* _totalResults; //NSNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property(nonatomic) NSArray* searchResults;
|
|
||||||
@property(nonatomic) NSNumber* totalResults;
|
|
||||||
- (id) searchResults: (NSArray*) searchResults
|
|
||||||
totalResults: (NSNumber*) totalResults;
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict;
|
|
||||||
- (NSDictionary*) asDictionary;
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
|||||||
#import "NIKDate.h"
|
|
||||||
#import "NIKWordSearchResults.h"
|
|
||||||
|
|
||||||
@implementation NIKWordSearchResults
|
|
||||||
|
|
||||||
@synthesize searchResults = _searchResults;
|
|
||||||
@synthesize totalResults = _totalResults;
|
|
||||||
- (id) searchResults: (NSArray*) searchResults
|
|
||||||
totalResults: (NSNumber*) totalResults
|
|
||||||
{
|
|
||||||
_searchResults = searchResults;
|
|
||||||
_totalResults = totalResults;
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) initWithValues: (NSDictionary*)dict
|
|
||||||
{
|
|
||||||
id searchResults_dict = [dict objectForKey:@"searchResults"];
|
|
||||||
if([searchResults_dict isKindOfClass:[NSArray class]]) {
|
|
||||||
if([(NSArray*)searchResults_dict count] > 0) {
|
|
||||||
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)searchResults_dict count]];
|
|
||||||
for (NSDictionary* dict in (NSArray*)searchResults_dict) {
|
|
||||||
NIKWordSearchResult* d = [[NIKWordSearchResult alloc]initWithValues:dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
_searchResults = [[NSArray alloc] initWithArray:objs];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_totalResults = [dict objectForKey:@"totalResults"];
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(NSDictionary*) asDictionary {
|
|
||||||
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
|
|
||||||
if(_searchResults != nil){
|
|
||||||
if([_searchResults isKindOfClass:[NSArray class]]){
|
|
||||||
NSMutableArray * array = [[NSMutableArray alloc] init];
|
|
||||||
for( NIKWordSearchResult * searchResults in (NSArray*)_searchResults) {
|
|
||||||
[array addObject:[(NIKSwaggerObject*)searchResults asDictionary]];
|
|
||||||
}
|
|
||||||
[dict setObject:array forKey:@"searchResults"];
|
|
||||||
}
|
|
||||||
else if(_searchResults && [_searchResults isKindOfClass:[NIKDate class]]) {
|
|
||||||
NSString * dateString = [(NIKDate*)_searchResults toString];
|
|
||||||
if(dateString){
|
|
||||||
[dict setObject:dateString forKey:@"searchResults"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(_searchResults != nil) [dict setObject:[(NIKSwaggerObject*)_searchResults asDictionary]forKey:@"searchResults"];
|
|
||||||
}
|
|
||||||
if(_totalResults != nil) [dict setObject:_totalResults forKey:@"totalResults"];
|
|
||||||
NSDictionary* output = [dict copy];
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "NIKApiInvoker.h"
|
|
||||||
#import "NIKWordObject.h"
|
|
||||||
#import "NIKDefinitionSearchResults.h"
|
|
||||||
#import "NIKWordOfTheDay.h"
|
|
||||||
#import "NIKWordSearchResults.h"
|
|
||||||
|
|
||||||
|
|
||||||
@interface NIKWordsApi: NSObject {
|
|
||||||
|
|
||||||
@private
|
|
||||||
NSOperationQueue *_queue;
|
|
||||||
NIKApiInvoker * _api;
|
|
||||||
}
|
|
||||||
@property(nonatomic, readonly) NSOperationQueue* queue;
|
|
||||||
@property(nonatomic, readonly) NIKApiInvoker* api;
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key;
|
|
||||||
|
|
||||||
-(void) 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 (^)(NIKWordSearchResults*, NSError *))completionBlock;
|
|
||||||
-(void) getWordOfTheDayWithCompletionBlock :(NSString*) date
|
|
||||||
completionHandler:(void (^)(NIKWordOfTheDay*, NSError *))completionBlock;
|
|
||||||
-(void) 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 (^)(NIKDefinitionSearchResults*, NSError *))completionBlock;
|
|
||||||
-(void) 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*, NSError *))completionBlock;
|
|
||||||
-(void) 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 (^)(NIKWordObject*, NSError *))completionBlock;
|
|
||||||
@end
|
|
@ -1,602 +0,0 @@
|
|||||||
#import "NIKWordsApi.h"
|
|
||||||
#import "NIKWordObject.h"
|
|
||||||
#import "NIKDefinitionSearchResults.h"
|
|
||||||
#import "NIKWordOfTheDay.h"
|
|
||||||
#import "NIKWordSearchResults.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation NIKWordsApi
|
|
||||||
static NSString * basePath = @"http://api.wordnik.com/v4";
|
|
||||||
|
|
||||||
@synthesize queue = _queue;
|
|
||||||
@synthesize api = _api;
|
|
||||||
|
|
||||||
- (id) init {
|
|
||||||
self = [super init];
|
|
||||||
_queue = [[NSOperationQueue alloc] init];
|
|
||||||
_api = [[NIKApiInvoker alloc] init];
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) addHeader:(NSString*) value
|
|
||||||
forKey:(NSString*)key {
|
|
||||||
[_api addHeader:value forKey:key];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKWordSearchResults
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) 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 (^)(NIKWordSearchResults*, NSError *))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: [_api escapeString:query]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(caseSensitive != nil)
|
|
||||||
[queryParams setValue:caseSensitive forKey:@"caseSensitive"];
|
|
||||||
if(includePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:includePartOfSpeech forKey:@"includePartOfSpeech"];
|
|
||||||
if(excludePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:excludePartOfSpeech forKey:@"excludePartOfSpeech"];
|
|
||||||
if(minCorpusCount != nil)
|
|
||||||
[queryParams setValue:minCorpusCount forKey:@"minCorpusCount"];
|
|
||||||
if(maxCorpusCount != nil)
|
|
||||||
[queryParams setValue:maxCorpusCount forKey:@"maxCorpusCount"];
|
|
||||||
if(minDictionaryCount != nil)
|
|
||||||
[queryParams setValue:minDictionaryCount forKey:@"minDictionaryCount"];
|
|
||||||
if(maxDictionaryCount != nil)
|
|
||||||
[queryParams setValue:maxDictionaryCount forKey:@"maxDictionaryCount"];
|
|
||||||
if(minLength != nil)
|
|
||||||
[queryParams setValue:minLength forKey:@"minLength"];
|
|
||||||
if(maxLength != nil)
|
|
||||||
[queryParams setValue:maxLength forKey:@"maxLength"];
|
|
||||||
if(skip != nil)
|
|
||||||
[queryParams setValue:skip forKey:@"skip"];
|
|
||||||
if(limit != nil)
|
|
||||||
[queryParams setValue:limit forKey:@"limit"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(query == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock( [[NIKWordSearchResults alloc]initWithValues: data], nil);}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKWordOfTheDay
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) getWordOfTheDayWithCompletionBlock :(NSString*) date
|
|
||||||
completionHandler:(void (^)(NIKWordOfTheDay*, NSError *))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"];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(date != nil)
|
|
||||||
[queryParams setValue:date forKey:@"date"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock( [[NIKWordOfTheDay alloc]initWithValues: data], nil);}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKDefinitionSearchResults
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) 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 (^)(NIKDefinitionSearchResults*, NSError *))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"];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(query != nil)
|
|
||||||
[queryParams setValue:query forKey:@"query"];
|
|
||||||
if(findSenseForWord != nil)
|
|
||||||
[queryParams setValue:findSenseForWord forKey:@"findSenseForWord"];
|
|
||||||
if(includeSourceDictionaries != nil)
|
|
||||||
[queryParams setValue:includeSourceDictionaries forKey:@"includeSourceDictionaries"];
|
|
||||||
if(excludeSourceDictionaries != nil)
|
|
||||||
[queryParams setValue:excludeSourceDictionaries forKey:@"excludeSourceDictionaries"];
|
|
||||||
if(includePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:includePartOfSpeech forKey:@"includePartOfSpeech"];
|
|
||||||
if(excludePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:excludePartOfSpeech forKey:@"excludePartOfSpeech"];
|
|
||||||
if(minCorpusCount != nil)
|
|
||||||
[queryParams setValue:minCorpusCount forKey:@"minCorpusCount"];
|
|
||||||
if(maxCorpusCount != nil)
|
|
||||||
[queryParams setValue:maxCorpusCount forKey:@"maxCorpusCount"];
|
|
||||||
if(minLength != nil)
|
|
||||||
[queryParams setValue:minLength forKey:@"minLength"];
|
|
||||||
if(maxLength != nil)
|
|
||||||
[queryParams setValue:maxLength forKey:@"maxLength"];
|
|
||||||
if(expandTerms != nil)
|
|
||||||
[queryParams setValue:expandTerms forKey:@"expandTerms"];
|
|
||||||
if(includeTags != nil)
|
|
||||||
[queryParams setValue:includeTags forKey:@"includeTags"];
|
|
||||||
if(sortBy != nil)
|
|
||||||
[queryParams setValue:sortBy forKey:@"sortBy"];
|
|
||||||
if(sortOrder != nil)
|
|
||||||
[queryParams setValue:sortOrder forKey:@"sortOrder"];
|
|
||||||
if(skip != nil)
|
|
||||||
[queryParams setValue:skip forKey:@"skip"];
|
|
||||||
if(limit != nil)
|
|
||||||
[queryParams setValue:limit forKey:@"limit"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(query == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock( [[NIKDefinitionSearchResults alloc]initWithValues: data], nil);}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKWordObject
|
|
||||||
* returnContainer: List
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) 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*, NSError *))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"];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(hasDictionaryDef != nil)
|
|
||||||
[queryParams setValue:hasDictionaryDef forKey:@"hasDictionaryDef"];
|
|
||||||
if(includePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:includePartOfSpeech forKey:@"includePartOfSpeech"];
|
|
||||||
if(excludePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:excludePartOfSpeech forKey:@"excludePartOfSpeech"];
|
|
||||||
if(minCorpusCount != nil)
|
|
||||||
[queryParams setValue:minCorpusCount forKey:@"minCorpusCount"];
|
|
||||||
if(maxCorpusCount != nil)
|
|
||||||
[queryParams setValue:maxCorpusCount forKey:@"maxCorpusCount"];
|
|
||||||
if(minDictionaryCount != nil)
|
|
||||||
[queryParams setValue:minDictionaryCount forKey:@"minDictionaryCount"];
|
|
||||||
if(maxDictionaryCount != nil)
|
|
||||||
[queryParams setValue:maxDictionaryCount forKey:@"maxDictionaryCount"];
|
|
||||||
if(minLength != nil)
|
|
||||||
[queryParams setValue:minLength forKey:@"minLength"];
|
|
||||||
if(maxLength != nil)
|
|
||||||
[queryParams setValue:maxLength forKey:@"maxLength"];
|
|
||||||
if(sortBy != nil)
|
|
||||||
[queryParams setValue:sortBy forKey:@"sortBy"];
|
|
||||||
if(sortOrder != nil)
|
|
||||||
[queryParams setValue:sortOrder forKey:@"sortOrder"];
|
|
||||||
if(limit != nil)
|
|
||||||
[queryParams setValue:limit forKey:@"limit"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(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) {
|
|
||||||
NIKWordObject* d = [[NIKWordObject alloc]initWithValues: dict];
|
|
||||||
[objs addObject:d];
|
|
||||||
}
|
|
||||||
completionBlock(objs, nil);
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* returnTypeIsPrimitive:
|
|
||||||
* returnBaseType: NIKWordObject
|
|
||||||
* returnContainer:
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
-(void) 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 (^)(NIKWordObject*, NSError *))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"];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(hasDictionaryDef != nil)
|
|
||||||
[queryParams setValue:hasDictionaryDef forKey:@"hasDictionaryDef"];
|
|
||||||
if(includePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:includePartOfSpeech forKey:@"includePartOfSpeech"];
|
|
||||||
if(excludePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:excludePartOfSpeech forKey:@"excludePartOfSpeech"];
|
|
||||||
if(minCorpusCount != nil)
|
|
||||||
[queryParams setValue:minCorpusCount forKey:@"minCorpusCount"];
|
|
||||||
if(maxCorpusCount != nil)
|
|
||||||
[queryParams setValue:maxCorpusCount forKey:@"maxCorpusCount"];
|
|
||||||
if(minDictionaryCount != nil)
|
|
||||||
[queryParams setValue:minDictionaryCount forKey:@"minDictionaryCount"];
|
|
||||||
if(maxDictionaryCount != nil)
|
|
||||||
[queryParams setValue:maxDictionaryCount forKey:@"maxDictionaryCount"];
|
|
||||||
if(minLength != nil)
|
|
||||||
[queryParams setValue:minLength forKey:@"minLength"];
|
|
||||||
if(maxLength != nil)
|
|
||||||
[queryParams setValue:maxLength forKey:@"maxLength"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
completionBlock( [[NIKWordObject alloc]initWithValues: data], nil);}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) searchWordsAsJsonWithCompletionBlock :(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 (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"query", @"}"]] withString: [_api escapeString:query]];
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(caseSensitive != nil)
|
|
||||||
[queryParams setValue:caseSensitive forKey:@"caseSensitive"];
|
|
||||||
if(includePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:includePartOfSpeech forKey:@"includePartOfSpeech"];
|
|
||||||
if(excludePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:excludePartOfSpeech forKey:@"excludePartOfSpeech"];
|
|
||||||
if(minCorpusCount != nil)
|
|
||||||
[queryParams setValue:minCorpusCount forKey:@"minCorpusCount"];
|
|
||||||
if(maxCorpusCount != nil)
|
|
||||||
[queryParams setValue:maxCorpusCount forKey:@"maxCorpusCount"];
|
|
||||||
if(minDictionaryCount != nil)
|
|
||||||
[queryParams setValue:minDictionaryCount forKey:@"minDictionaryCount"];
|
|
||||||
if(maxDictionaryCount != nil)
|
|
||||||
[queryParams setValue:maxDictionaryCount forKey:@"maxDictionaryCount"];
|
|
||||||
if(minLength != nil)
|
|
||||||
[queryParams setValue:minLength forKey:@"minLength"];
|
|
||||||
if(maxLength != nil)
|
|
||||||
[queryParams setValue:maxLength forKey:@"maxLength"];
|
|
||||||
if(skip != nil)
|
|
||||||
[queryParams setValue:skip forKey:@"skip"];
|
|
||||||
if(limit != nil)
|
|
||||||
[queryParams setValue:limit forKey:@"limit"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(query == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) getWordOfTheDayAsJsonWithCompletionBlock :(NSString*) date
|
|
||||||
completionHandler:(void (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(date != nil)
|
|
||||||
[queryParams setValue:date forKey:@"date"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) reverseDictionaryAsJsonWithCompletionBlock :(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 (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(query != nil)
|
|
||||||
[queryParams setValue:query forKey:@"query"];
|
|
||||||
if(findSenseForWord != nil)
|
|
||||||
[queryParams setValue:findSenseForWord forKey:@"findSenseForWord"];
|
|
||||||
if(includeSourceDictionaries != nil)
|
|
||||||
[queryParams setValue:includeSourceDictionaries forKey:@"includeSourceDictionaries"];
|
|
||||||
if(excludeSourceDictionaries != nil)
|
|
||||||
[queryParams setValue:excludeSourceDictionaries forKey:@"excludeSourceDictionaries"];
|
|
||||||
if(includePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:includePartOfSpeech forKey:@"includePartOfSpeech"];
|
|
||||||
if(excludePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:excludePartOfSpeech forKey:@"excludePartOfSpeech"];
|
|
||||||
if(minCorpusCount != nil)
|
|
||||||
[queryParams setValue:minCorpusCount forKey:@"minCorpusCount"];
|
|
||||||
if(maxCorpusCount != nil)
|
|
||||||
[queryParams setValue:maxCorpusCount forKey:@"maxCorpusCount"];
|
|
||||||
if(minLength != nil)
|
|
||||||
[queryParams setValue:minLength forKey:@"minLength"];
|
|
||||||
if(maxLength != nil)
|
|
||||||
[queryParams setValue:maxLength forKey:@"maxLength"];
|
|
||||||
if(expandTerms != nil)
|
|
||||||
[queryParams setValue:expandTerms forKey:@"expandTerms"];
|
|
||||||
if(includeTags != nil)
|
|
||||||
[queryParams setValue:includeTags forKey:@"includeTags"];
|
|
||||||
if(sortBy != nil)
|
|
||||||
[queryParams setValue:sortBy forKey:@"sortBy"];
|
|
||||||
if(sortOrder != nil)
|
|
||||||
[queryParams setValue:sortOrder forKey:@"sortOrder"];
|
|
||||||
if(skip != nil)
|
|
||||||
[queryParams setValue:skip forKey:@"skip"];
|
|
||||||
if(limit != nil)
|
|
||||||
[queryParams setValue:limit forKey:@"limit"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
if(query == nil) {
|
|
||||||
// error
|
|
||||||
}
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) getRandomWordsAsJsonWithCompletionBlock :(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 (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(hasDictionaryDef != nil)
|
|
||||||
[queryParams setValue:hasDictionaryDef forKey:@"hasDictionaryDef"];
|
|
||||||
if(includePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:includePartOfSpeech forKey:@"includePartOfSpeech"];
|
|
||||||
if(excludePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:excludePartOfSpeech forKey:@"excludePartOfSpeech"];
|
|
||||||
if(minCorpusCount != nil)
|
|
||||||
[queryParams setValue:minCorpusCount forKey:@"minCorpusCount"];
|
|
||||||
if(maxCorpusCount != nil)
|
|
||||||
[queryParams setValue:maxCorpusCount forKey:@"maxCorpusCount"];
|
|
||||||
if(minDictionaryCount != nil)
|
|
||||||
[queryParams setValue:minDictionaryCount forKey:@"minDictionaryCount"];
|
|
||||||
if(maxDictionaryCount != nil)
|
|
||||||
[queryParams setValue:maxDictionaryCount forKey:@"maxDictionaryCount"];
|
|
||||||
if(minLength != nil)
|
|
||||||
[queryParams setValue:minLength forKey:@"minLength"];
|
|
||||||
if(maxLength != nil)
|
|
||||||
[queryParams setValue:maxLength forKey:@"maxLength"];
|
|
||||||
if(sortBy != nil)
|
|
||||||
[queryParams setValue:sortBy forKey:@"sortBy"];
|
|
||||||
if(sortOrder != nil)
|
|
||||||
[queryParams setValue:sortOrder forKey:@"sortOrder"];
|
|
||||||
if(limit != nil)
|
|
||||||
[queryParams setValue:limit forKey:@"limit"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) getRandomWordAsJsonWithCompletionBlock :(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 (^)(NSString*, NSError *))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:@""];
|
|
||||||
|
|
||||||
NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
|
|
||||||
if(hasDictionaryDef != nil)
|
|
||||||
[queryParams setValue:hasDictionaryDef forKey:@"hasDictionaryDef"];
|
|
||||||
if(includePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:includePartOfSpeech forKey:@"includePartOfSpeech"];
|
|
||||||
if(excludePartOfSpeech != nil)
|
|
||||||
[queryParams setValue:excludePartOfSpeech forKey:@"excludePartOfSpeech"];
|
|
||||||
if(minCorpusCount != nil)
|
|
||||||
[queryParams setValue:minCorpusCount forKey:@"minCorpusCount"];
|
|
||||||
if(maxCorpusCount != nil)
|
|
||||||
[queryParams setValue:maxCorpusCount forKey:@"maxCorpusCount"];
|
|
||||||
if(minDictionaryCount != nil)
|
|
||||||
[queryParams setValue:minDictionaryCount forKey:@"minDictionaryCount"];
|
|
||||||
if(maxDictionaryCount != nil)
|
|
||||||
[queryParams setValue:maxDictionaryCount forKey:@"maxDictionaryCount"];
|
|
||||||
if(minLength != nil)
|
|
||||||
[queryParams setValue:minLength forKey:@"minLength"];
|
|
||||||
if(maxLength != nil)
|
|
||||||
[queryParams setValue:maxLength forKey:@"maxLength"];
|
|
||||||
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
|
|
||||||
id bodyDictionary = nil;
|
|
||||||
[_api dictionaryWithCompletionBlock: requestUrl
|
|
||||||
method: @"GET"
|
|
||||||
queryParams: queryParams
|
|
||||||
body: bodyDictionary
|
|
||||||
headerParams: headerParams
|
|
||||||
completionHandler: ^(NSDictionary *data, NSError *error) {
|
|
||||||
if (error) {
|
|
||||||
completionBlock(nil, error);return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSData * responseData = nil;
|
|
||||||
if([data isKindOfClass:[NSDictionary class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
else if ([data isKindOfClass:[NSArray class]]){
|
|
||||||
responseData = [NSJSONSerialization dataWithJSONObject:data
|
|
||||||
options:kNilOptions error:&error];
|
|
||||||
}
|
|
||||||
NSString * json = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
|
|
||||||
completionBlock(json, nil);
|
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
Loading…
x
Reference in New Issue
Block a user