VLDAPIClient
@interface VLDAPIClient
The API Client provides a convenient way to upload VLDRecord objects to Validic’s servers. It handles creating proper URLs, constructing the request object and parsing the server response.
-
Initializes VLDAPIClient with a VLDUser
Declaration
Objective-C
- (instancetype)initWithUser:(VLDUser *)user;
Parameters
user
A VLDUser to authenticate all network requests with.
-
This method submits a record object to be written to the server.
Declaration
Objective-C
- (void)postRecord:(VLDRecord *)record completion:(VLDRecordResponseBlock)completion;
Parameters
record
A VLDRecord subclass object.
completion
A VLDRecordResponseBlock block that is called when the network request has completed containing either the updated VLDRecord object or an error.
-
This method batch submits multiple record objects to be written to the server.
Declaration
Objective-C
- (void)postMultipleRecords:(id)records completion:(VLDMultiRecordResponseBlock)completion;
Parameters
records
An array of VLDRecord subclass objects (all the same type).
completion
A VLDMultiRecordResponseBlock block that is called when the network request has completed containing the updated VLDRecord objects and/or an error.
-
This method updates an existing record object on the server.
Declaration
Objective-C
- (void)updateRecord:(VLDRecord *)record completion:(VLDRecordResponseBlock)completion;
Parameters
record
A VLDRecord subclass object with updated values and the recordID and activityID of the record to update.
completion
A VLDRecordResponseBlock block that is called when the network request has completed containing either the updated VLDRecord object or an error.
-
This method deletes an existing record object on the server.
Declaration
Objective-C
- (void)deleteRecord:(VLDRecord *)record completion:(VLDDeleteResponseBlock)completion;
Parameters
record
A VLDRecord subclass object with the recordID and activityID of the record to delete.
completion
A VLDDeleteResponseBlock block that is called when the network request has completed containing either the server response dictionary or an error.
-
This method uploads an image to be associated with a record object which already exists on the server.
Declaration
Objective-C
- (void)uploadImage:(UIImage *)image forRecord:(VLDRecord *)record completion:(VLDImageUploadResponseBlock)completion;
Parameters
image
A UIImage which contains the image data to upload.
record
A VLDRecord subclass object with the recordID and activityID of the record to associate with the image.
completion
A VLDImageUploadResponseBLock block that is called when the network request has completed containing either the server response dictionary or an error.
-
This method upserts (update or insert) a record object on the server.
Declaration
Objective-C
- (void)upsertRecord:(VLDRecord *)record completion:(VLDRecordResponseBlock)completion;
Parameters
record
A VLDRecord subclass object with the activityID of the record to upsert.
completion
A VLDDeleteResponseBlock block that is called when the network request has completed containing either the server response dictionary or an error.