TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
PostageKit is an Objective-C wrapper for the popular PostageApp transactional mail service and allows developers to access the PostageApp API from their iOS / Mac OSX applications.
You can also manually import the files from the PostageKit/
folder into your project if you don't use Cocoapods. Note that PostageKit relies on AFNetworking, so you will need to add those files manually as well.
The API provides an asynchronous client interface by using blocks. To start using the API, you will first need to setup the API client with your PostageApp project API key:
PostageClient *client = [PostageApp sharedClient];
client.projectAPIKey = @"Your API Key here";
For example, to grab the messages sent for your project:
[client messagesWithSuccess:^(NSDictionary *messages) {
NSLog(@"Messages sent: %@", messages);
} error:^(NSError *error, id json) {
NSLog(@"API Error occurred: %@, JSON: %@", error, json);
}];
Some of the types have models that make it easier to traverse:
[client accountInfoWithSuccess:^(AccountInfo *info) {
NSLog(@"Account Name: %@", info.name);
} error:^(NSError *error, id json) {
// Error
}];
You can also send messages as well!
MessageParams *params = [MessageParams params];
params.UID = @"12345678abcdefg";
params.recipients = @[ @"[email protected]" ];
params.content = @{@"text/plain" : @"This is a test!"};
[_client sendMessage:params success:^(NSUInteger messageID) {
NSLog(@"Message ID: %d", messageID);
} error:^(NSError *error, id json) {
// Error
}];