VLDAPIClient Class Reference

Inherits from NSObject
Declared in VLDAPIClient.h

Overview

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.

– initWithUser:

Initializes VLDAPIClient with a VLDUser

- (instancetype)initWithUser:(VLDUser *)user

Parameters

user

A VLDUser to authenticate all network requests with.

Discussion

Initializes VLDAPIClient with a VLDUser

Declared In

VLDAPIClient.h

– postRecord:completion:

This method submits a record object to be written to the server.

- (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.

Discussion

This method submits a record object to be written to the server.

Declared In

VLDAPIClient.h

– postMultipleRecords:completion:

This method batch submits multiple record objects to be written to the server.

- (void)postMultipleRecords:(NSArray *)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.

Discussion

This method batch submits multiple record objects to be written to the server.

Declared In

VLDAPIClient.h

– updateRecord:completion:

This method updates an existing record object on the server.

- (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.

Discussion

This method updates an existing record object on the server.

Declared In

VLDAPIClient.h

– deleteRecord:completion:

This method deletes an existing record object on the server.

- (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.

Discussion

This method deletes an existing record object on the server.

Declared In

VLDAPIClient.h

– uploadImage:forRecord:completion:

This method uploads an image to be associated with a record object which already exists on the server.

- (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.

Discussion

This method uploads an image to be associated with a record object which already exists on the server.

Declared In

VLDAPIClient.h

– upsertRecord:completion:

This method upserts (update or insert) a record object on the server.

- (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.

Discussion

This method upserts (update or insert) a record object on the server.

Declared In

VLDAPIClient.h