Skip to content

Instantly share code, notes, and snippets.

@MariuszWisniewski
Last active August 29, 2015 14:01
Show Gist options
  • Save MariuszWisniewski/8112d6b524a0c84e001b to your computer and use it in GitHub Desktop.
Save MariuszWisniewski/8112d6b524a0c84e001b to your computer and use it in GitHub Desktop.
Creating New Data Object in Syncano
@interface SyncanoCommunication : NSObject
@property (strong, nonatomic) Syncano *syncano;
- (void)sendText:(NSString *)text image:(UIImage *)image;
@end
@implementation SyncanoCommunication
- (Syncano *)syncano {
if (_syncano == nil) {
_syncano = [Syncano syncanoForDomain:@"DOMAIN_NAME" apiKey:@"YOUR_API_KEY"];
}
return _syncano;
}
// Using collection_id
- (void)sendText:(NSString *)text image:(UIImage *)image {
SyncanoParameters_DataObjects_New *params = [[SyncanoParameters_DataObjects_New alloc] initWithProjectId:@"707" collectionId:@"3511" state:@"pending"];
params.text = text;
params.image = image;
SyncanoResponse_DataObjects_New *response = [self.syncano dataNew:params];
/* OR
SyncanoResponse_DataObjects_New *response = (SyncanoResponse_DataObjects_New *)[self.syncano sendRequest:params];
*/
}
// Using collection_key
- (void)sendText:(NSString *)text image:(UIImage *)image {
SyncanoParameters_DataObjects_New *params = [[SyncanoParameters_DataObjects_New alloc] initWithProjectId:@"707" collectionKey:@"MsgTest" state:@"pending"];
params.text = text;
params.image = image;
SyncanoResponse_DataObjects_New *response = [self.syncano dataNew:params];
/* OR
SyncanoResponse_DataObjects_New *response = (SyncanoResponse_DataObjects_New *)[self.syncano sendRequest:params];
*/
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment