Skip to content

Commit

Permalink
Support for machine-only posts
Browse files Browse the repository at this point in the history
  • Loading branch information
beccadax committed Sep 29, 2012
1 parent 17eff20 commit 1bc62ee
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions ANDraft.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

@property (strong) NSString * text;
@property (assign) ANResourceID replyTo;
@property (assign) BOOL machineOnly;
@property (readonly) NSMutableArray * annotations;
//@property (strong) NSArray * links;

Expand Down
8 changes: 7 additions & 1 deletion ANDraft.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ - (id)init {
- (NSDictionary *)representation {
NSMutableDictionary * dict = [NSMutableDictionary new];

[dict setObject:self.text forKey:@"text"];
if(self.machineOnly) {
[dict setObject:@"1" forKey:@"machine_only"];
}
else {
[dict setObject:self.text forKey:@"text"];
}

if(self.replyTo) {
[dict setObject:[NSString stringWithFormat:@"%llu", self.replyTo] forKey:@"reply_to"];
}
Expand Down
2 changes: 2 additions & 0 deletions ANPost.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
@property (readonly) ANSource * source;
@property (readonly) NSDictionary * sourceRepresentation;

@property (readonly) BOOL machineOnly;

// Either repostOf.ID or just ID
@property (readonly) ANResourceID originalID;

Expand Down
1 change: 1 addition & 0 deletions ANPost.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ @implementation ANPost
@dynamic userRepresentation;
@dynamic source;
@dynamic sourceRepresentation;
@dynamic machineOnly;
@dynamic numberOfStars;
@dynamic youStarred;
@dynamic starredByRepresentation;
Expand Down
1 change: 1 addition & 0 deletions ANRequestReturningPostList.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@property (assign) BOOL includeMuted;
@property (assign) BOOL includeDeleted;
@property (assign) BOOL includeStarredBy;
@property (assign) BOOL includeMachine;
@property (assign) BOOL includeReposters;

- (void)sendRequestWithCompletion:(ANPostListRequestCompletion)completion;
Expand Down
2 changes: 2 additions & 0 deletions ANRequestReturningPostList.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ - (id)initWithSession:(ANSession *)session {
_includeDeleted = YES;
_includeMuted = NO;
_includeStarredBy = NO;
_includeMachine = NO;
_includeReposters = NO;
}

Expand All @@ -41,6 +42,7 @@ - (NSDictionary *)parameters {
[self stringForBoolean:self.includeDeleted], @"include_deleted",
[self stringForBoolean:self.includeMuted], @"include_muted",
[self stringForBoolean:self.includeStarredBy], @"include_starred_by",
[self stringForBoolean:self.includeMachine], @"include_machine",
[self stringForBoolean:self.includeReposters], @"include_reposters",
nil];

Expand Down

0 comments on commit 1bc62ee

Please sign in to comment.