Private
Public Access
1
0

MessagesList: Add support for beforeMessageGUID and beforeDate

This commit is contained in:
James Magahern
2022-08-03 16:52:39 -07:00
parent ebad248c1c
commit c7087a394e
8 changed files with 168 additions and 8 deletions

View File

@@ -0,0 +1,18 @@
//
// MBIMErrorResponse.h
// kordophoned
//
// Created by James Magahern on 8/3/22.
// Copyright © 2022 James Magahern. All rights reserved.
//
#import "HTTPDataResponse.h"
NS_ASSUME_NONNULL_BEGIN
@interface MBIMErrorResponse : HTTPDataResponse
- (instancetype)initWithErrorCode:(int)httpErrorCode;
- (instancetype)initWithErrorCode:(int)httpErrorCode message:(NSString *)message;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,38 @@
//
// MBIMErrorResponse.m
// kordophoned
//
// Created by James Magahern on 8/3/22.
// Copyright © 2022 James Magahern. All rights reserved.
//
#import "MBIMErrorResponse.h"
@implementation MBIMErrorResponse {
int _status;
}
- (instancetype)initWithErrorCode:(int)httpErrorCode
{
if (self = [super initWithData:nil]) {
_status = httpErrorCode;
}
return self;
}
- (instancetype)initWithErrorCode:(int)httpErrorCode message:(NSString *)message
{
if (self = [super initWithData:[message dataUsingEncoding:NSUTF8StringEncoding]]) {
_status = httpErrorCode;
}
return self;
}
- (NSInteger)status
{
return _status;
}
@end

View File

@@ -10,3 +10,13 @@
NSString* MBIMWebServerFormatRFC822(NSDate *date);
NSString* MBIMWebServerFormatISO8601(NSDate *date);
@interface NSDate (MBIMWebServerFormat)
- (NSString *)RFC822StringValue;
- (NSString *)ISO8601StringValue;
@end
@interface NSString (MBIMWebServerFormat)
- (NSDate *)RFC822Date;
- (NSDate *)ISO8601Date;
@end

View File

@@ -47,3 +47,31 @@ NSString* MBIMWebServerFormatISO8601(NSDate *date)
return string;
}
@implementation NSDate (MBIMWebServerFormat)
- (NSString *)RFC822StringValue
{
return MBIMWebServerFormatRFC822(self);
}
- (NSString *)ISO8601StringValue
{
return MBIMWebServerFormatISO8601(self);
}
@end
@implementation NSString (MBIMWebServerFormat)
- (NSDate *)RFC822Date
{
return [_dateFormatterRFC822 dateFromString:self];
}
- (NSDate *)ISO8601Date
{
return [_dateFormatterISO8601 dateFromString:self];
}
@end