Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for /config #82

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions ADNKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions ADNKit/ADNKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import <ADNKit/ANKResourceMap.h>

#import <ADNKit/ANKClient.h>
#import <ADNKit/ANKClient+ANKConfiguration.h>
#import <ADNKit/ANKClient+ANKUser.h>
#import <ADNKit/ANKClient+ANKPost.h>
#import <ADNKit/ANKClient+ANKPostStreams.h>
Expand All @@ -39,6 +40,11 @@
#import <ADNKit/ANKChannelCounts.h>
#import <ADNKit/ANKACL.h>

#import <ADNKit/ANKConfiguration.h>
#import <ADNKit/ANKResourceConfiguration.h>
#import <ADNKit/ANKTextConfiguration.h>
#import <ADNKit/ANKURITemplateLength.h>

#import <ADNKit/ANKPlace.h>
#import <ADNKit/ANKPlaceCategory.h>

Expand Down
13 changes: 13 additions & 0 deletions ADNKit/ANKClient+ANKConfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// ANKClient+ANKConfiguration.h
// ADNKit
//
// Created by Rob Brambley on 4/2/14.
// Copyright (c) 2014 Afterwork Studios. All rights reserved.
//

@interface ANKClient (ANKConfiguration)

- (ANKJSONRequestOperation *)fetchConfigurationWithCompletion:(ANKClientCompletionBlock)completionHandler;

@end
21 changes: 21 additions & 0 deletions ADNKit/ANKClient+ANKConfiguration.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// ANKClient+ANKConfiguration.m
// ADNKit
//
// Created by Rob Brambley on 4/2/14.
// Copyright (c) 2014 Afterwork Studios. All rights reserved.
//

#import "ANKClient+ANKConfiguration.h"
#import "ANKConfiguration.h"

@implementation ANKClient (ANKConfiguration)

- (ANKJSONRequestOperation *)fetchConfigurationWithCompletion:(ANKClientCompletionBlock)completionHandler {
return [self enqueueGETPath:@"config"
parameters:nil
success:[self successHandlerForResourceClass:[ANKConfiguration class] clientHandler:completionHandler]
failure:[self failureHandlerForClientHandler:completionHandler]];
}

@end
20 changes: 20 additions & 0 deletions ADNKit/ANKConfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// ANKConfiguration.h
// ADNKit
//
// Created by Rob Brambley on 4/2/14.
// Copyright (c) 2014 Afterwork Studios. All rights reserved.
//

@class ANKResourceConfiguration, ANKTextConfiguration;

@interface ANKConfiguration : ANKResource

@property ANKTextConfiguration *text;
@property ANKResourceConfiguration *user;
@property ANKResourceConfiguration *file;
@property ANKResourceConfiguration *post;
@property ANKResourceConfiguration *message;
@property ANKResourceConfiguration *channel;

@end
22 changes: 22 additions & 0 deletions ADNKit/ANKConfiguration.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// ANKConfiguration.m
// ADNKit
//
// Created by Rob Brambley on 4/2/14.
// Copyright (c) 2014 Afterwork Studios. All rights reserved.
//

#import "ANKConfiguration.h"

@implementation ANKConfiguration
+ (NSDictionary *)JSONToLocalKeyMapping {
return [[super JSONToLocalKeyMapping] ank_dictionaryByAppendingDictionary:@{
@"text": @"text",
@"user": @"user",
@"file": @"file",
@"post": @"post",
@"message": @"message",
@"channel": @"channel"}];
}

@end
14 changes: 14 additions & 0 deletions ADNKit/ANKResourceConfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ANKResourceConfiguration.h
// ADNKit
//
// Created by Rob Brambley on 4/2/14.
// Copyright (c) 2014 Afterwork Studios. All rights reserved.
//

@interface ANKResourceConfiguration : ANKResource

@property NSInteger annotationMaxBytes;
@property NSInteger textMaxLength;

@end
18 changes: 18 additions & 0 deletions ADNKit/ANKResourceConfiguration.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// ANKResourceConfiguration.m
// ADNKit
//
// Created by Rob Brambley on 4/2/14.
// Copyright (c) 2014 Afterwork Studios. All rights reserved.
//

#import "ANKResourceConfiguration.h"

@implementation ANKResourceConfiguration
+ (NSDictionary *)JSONToLocalKeyMapping {
return [[super JSONToLocalKeyMapping] ank_dictionaryByAppendingDictionary:@{
@"annotation_max_bytes": @"annotationMaxBytes",
@"text_max_length": @"textMaxLength"}];
}

@end
15 changes: 15 additions & 0 deletions ADNKit/ANKTextConfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// ANKTextConfiguration.h
// ADNKit
//
// Created by Rob Brambley on 4/2/14.
// Copyright (c) 2014 Afterwork Studios. All rights reserved.
//

@class ANKURITemplateLength;

@interface ANKTextConfiguration : ANKResource

@property ANKURITemplateLength *URITemplateLength;

@end
18 changes: 18 additions & 0 deletions ADNKit/ANKTextConfiguration.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// ANKTextConfiguration.m
// ADNKit
//
// Created by Rob Brambley on 4/2/14.
// Copyright (c) 2014 Afterwork Studios. All rights reserved.
//

#import "ANKTextConfiguration.h"

@implementation ANKTextConfiguration

+ (NSDictionary *)JSONToLocalKeyMapping {
return [[super JSONToLocalKeyMapping] ank_dictionaryByAppendingDictionary:@{
@"uri_template_length": @"URITemplateLength"}];
}

@end
14 changes: 14 additions & 0 deletions ADNKit/ANKURITemplateLength.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ANKURITemplateLength.h
// ADNKit
//
// Created by Rob Brambley on 4/2/14.
// Copyright (c) 2014 Afterwork Studios. All rights reserved.
//

@interface ANKURITemplateLength : ANKResource

@property NSInteger postID;
@property NSInteger messageID;

@end
19 changes: 19 additions & 0 deletions ADNKit/ANKURITemplateLength.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// ANKURITemplateLength.m
// ADNKit
//
// Created by Rob Brambley on 4/2/14.
// Copyright (c) 2014 Afterwork Studios. All rights reserved.
//

#import "ANKURITemplateLength.h"

@implementation ANKURITemplateLength

+ (NSDictionary *)JSONToLocalKeyMapping {
return [[super JSONToLocalKeyMapping] ank_dictionaryByAppendingDictionary:@{
@"post_id": @"postID",
@"message_id": @"messageID"}];
}

@end