Created
May 17, 2016 21:20
-
-
Save klefevre/77045cebb53f8af854e553e6341fce3a to your computer and use it in GitHub Desktop.
MailCore example with generics and nullability annotations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MCOMailProvider.h | |
// mailcore2 | |
// | |
// Created by Robert Widmann on 4/28/13. | |
// Copyright (c) 2013 MailCore. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
/** | |
Represents a email service provider, like for example Gmail, Yahoo, Fastmail.fm etc. | |
*/ | |
@class MCONetService; | |
@interface MCOMailProvider : NSObject | |
@property (nonatomic, copy, nullable) NSString * identifier; | |
- (nullable instancetype) initWithInfo:(NSDictionary<NSString *, NSObject *> * __nonnull)info; | |
/** | |
A list of ways that you can connect to the IMAP server | |
@return An array of MCONetService | |
*/ | |
- (NSArray<MCONetService *> * __nonnull) imapServices; | |
/** | |
A list of ways that you can connect to the SMTP server | |
@return An array of MCONetService | |
*/ | |
- (NSArray<MCONetService *> * __nonnull) smtpServices; | |
/** | |
A list of ways that you can connect to the POP3 server | |
@return An array of MCONetService | |
*/ | |
- (NSArray<MCONetService *> * __nonnull) popServices; | |
- (BOOL) matchEmail:(NSString * __nonnull)email; | |
- (BOOL) matchMX:(NSString * __nonnull)hostname; | |
/** | |
Where sent mail is stored on the IMAP server | |
@return Returns nil if it is unknown | |
*/ | |
- (NSString * __nullable) sentMailFolderPath; | |
/** | |
Where starred mail is stored on the IMAP server. | |
This only applies to some servers like Gmail | |
@return Returns nil if it is unknown | |
*/ | |
- (NSString * __nullable) starredFolderPath; | |
/** | |
Where all mail or the archive folder is stored on the IMAP server | |
@return Returns nil if it is unknown | |
*/ | |
- (NSString * __nullable) allMailFolderPath; | |
/** | |
Where trash is stored on the IMAP server | |
@return Returns nil if it is unknown | |
*/ | |
- (NSString * __nullable) trashFolderPath; | |
/** | |
Where draft messages are stored on the IMAP server | |
@return Returns nil if it is unknown | |
*/ | |
- (NSString * __nullable) draftsFolderPath; | |
/** | |
Where spam messages are stored on the IMAP server | |
@return Returns nil if it is unknown | |
*/ | |
- (NSString * __nullable) spamFolderPath; | |
/** | |
Where important messages are stored on the IMAP server | |
This only applies to some servers, like Gmail | |
@return Returns nil if it is unknown | |
*/ | |
- (NSString * __nullable) importantFolderPath; | |
@end | |
@interface MCOMailProvider (MCOUnavailable) | |
/** Do not invoke this directly. */ | |
- (nullable instancetype) init NS_UNAVAILABLE; | |
/** Do not invoke this directly. */ | |
+ (nullable instancetype) new NS_UNAVAILABLE; | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment