Skip to content

Commit

Permalink
Expose unique "id" parameter/remove paginationID for some resources
Browse files Browse the repository at this point in the history
I realize that in one of my previous patches I marked a few of these
as paginatable, when in fact they aren't.
  • Loading branch information
berg committed Feb 24, 2014
1 parent 30603a2 commit d821fbd
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 8 deletions.
5 changes: 5 additions & 0 deletions ADNKit/ANKChannel.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ + (NSDictionary *)JSONToLocalKeyMapping {
}


- (NSString *)uniqueID {
return self.channelID;
}


- (BOOL)isPrivateMessageChannel {
return [self.type isEqualToString:@"net.app.core.pm"];
}
Expand Down
4 changes: 2 additions & 2 deletions ADNKit/ANKExploreStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#import "ANKPaginatableResource.h"
#import "ANKResource.h"


@interface ANKExploreStream : ANKPaginatableResource
@interface ANKExploreStream : ANKResource

@property (strong) NSString *slug;
@property (strong) NSString *title;
Expand Down
5 changes: 5 additions & 0 deletions ADNKit/ANKFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ - (NSDictionary *)oembedAnnotationValue {
}


- (NSString *)uniqueID {
return self.fileID;
}


- (void)updateObjectFromJSONDictionary:(NSDictionary *)JSONDictionary {
NSMutableDictionary *mutableJSONDictionary = [NSMutableDictionary dictionaryWithDictionary:JSONDictionary];
NSString *derivedFilesKey = [[self class] JSONKeyForLocalKey:@"derivedFiles"];
Expand Down
4 changes: 2 additions & 2 deletions ADNKit/ANKFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#import "ANKPaginatableResource.h"
#import "ANKResource.h"


typedef NS_ENUM(NSUInteger, ANKFilterMatchPolicy) {
Expand All @@ -21,7 +21,7 @@ typedef NS_ENUM(NSUInteger, ANKFilterMatchPolicy) {
};


@interface ANKFilter : ANKPaginatableResource
@interface ANKFilter : ANKResource

@property (strong) NSString *filterID;
@property (strong) NSString *name;
Expand Down
1 change: 1 addition & 0 deletions ADNKit/ANKInteraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

@interface ANKInteraction : ANKPaginatableResource

@property (strong) NSString *interactionID;
@property (strong) NSString *actionString;
@property (strong) NSDate *eventDate;
@property (strong) NSArray *objects;
Expand Down
5 changes: 5 additions & 0 deletions ADNKit/ANKInteraction.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ + (Class)usersCollectionObjectClass {
}


- (NSString *)uniqueID {
return self.interactionID;
}


@end
5 changes: 5 additions & 0 deletions ADNKit/ANKMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ + (NSDictionary *)JSONToLocalKeyMapping {
}


- (NSString *)uniqueID {
return self.messageID;
}


- (void)objectDidUpdate {
[super objectDidUpdate];
self.entities.text = self.text;
Expand Down
1 change: 1 addition & 0 deletions ADNKit/ANKPaginatableResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
@interface ANKPaginatableResource : ANKResource

@property (strong) NSString *paginationID;
@property (strong, readonly) NSString *uniqueID;

@end
5 changes: 5 additions & 0 deletions ADNKit/ANKPaginatableResource.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ + (NSDictionary *)JSONToLocalKeyMapping {
return [[super JSONToLocalKeyMapping] ank_dictionaryByAppendingDictionary:@{@"pagination_id": @"paginationID"}];
}

- (NSString *)uniqueID {
// must be overridden in any subclass of this object
return nil;
}

@end
4 changes: 2 additions & 2 deletions ADNKit/ANKPlace.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#import "ANKPaginatableResource.h"
#import "ANKResource.h"
#import <CoreLocation/CoreLocation.h>


Expand All @@ -27,7 +27,7 @@ static NSString *const kANKPlaceSearchParamVerticalAccuracy = @"vertical_accurac
static NSString *const kANKPlaceSearchParamRemoveClosed = @"remove_closed";


@interface ANKPlace : ANKPaginatableResource <ANKAnnotationReplacement>
@interface ANKPlace : ANKResource <ANKAnnotationReplacement>

@property (strong) NSString *factualID;
@property (strong) NSString *name;
Expand Down
5 changes: 5 additions & 0 deletions ADNKit/ANKPost.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ - (void)objectDidUpdate {
}


- (NSString *)uniqueID {
return self.postID;
}


- (NSString *)description {
return [NSString stringWithFormat:@"<%@ %p> - @%@: %@", NSStringFromClass([self class]), self, self.user.username, self.text];
}
Expand Down
4 changes: 2 additions & 2 deletions ADNKit/ANKStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#import "ANKPaginatableResource.h"
#import "ANKResource.h"


@class ANKFilter;

@interface ANKStream : ANKPaginatableResource
@interface ANKStream : ANKResource

@property (strong) NSString *streamID;
@property (strong) NSString *endpoint;
Expand Down
5 changes: 5 additions & 0 deletions ADNKit/ANKUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ + (NSDictionary *)JSONToLocalKeyMapping {
}


- (NSString *)uniqueID {
return self.userID;
}


- (NSString *)description {
return [NSString stringWithFormat:@"<%@ %p> - %@ (@%@)", NSStringFromClass([self class]), self, self.name, self.username];
}
Expand Down

0 comments on commit d821fbd

Please sign in to comment.