MessagesList: Add support for beforeMessageGUID and beforeDate
This commit is contained in:
18
kordophone/Bridge/Operations/Utilities/MBIMErrorResponse.h
Normal file
18
kordophone/Bridge/Operations/Utilities/MBIMErrorResponse.h
Normal 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
|
||||
38
kordophone/Bridge/Operations/Utilities/MBIMErrorResponse.m
Normal file
38
kordophone/Bridge/Operations/Utilities/MBIMErrorResponse.m
Normal 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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user