VLDAPIClient

Objective-C

@interface VLDAPIClient : NSObject

Swift

class VLDAPIClient : NSObject

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;

    Swift

    init!(user: VLDUser!)

    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;

    Swift

    func post(_ record: VLDRecord!) async throws -> VLDRecord?

    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:(NSArray *)records
                     completion:(VLDMultiRecordResponseBlock)completion;

    Swift

    func postMultipleRecords(_ records: [Any]!) async throws -> [Any]?

    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;

    Swift

    func update(_ record: VLDRecord!) async throws -> VLDRecord?

    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;

    Swift

    func delete(_ record: VLDRecord!) async throws -> VLDServerResponse?

    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;

    Swift

    func uploadImage(_ image: UIImage!, for record: VLDRecord!) async throws -> VLDMedia?

    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;

    Swift

    func upsertRecord(_ record: VLDRecord!) async throws -> VLDRecord?

    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.