FMPResource

Description

The FMPResource class is used to describe resource.

class FMPResource

Properties

Property Description

name

Resource name.
var name: String { get }
params Input parameters for resource request.
var params: String { get }
isDelta The use of the deltaStream method on request to server.
var isDelta: Bool { get }

isLocalCached

Use table caching in local database.
var isLocalCached: Bool { get }

isFiltered

Use filtering by columns on request to server.
var isFiltered: Bool { get }

meta

Information about resource contains in resources scheme.
var meta: FMPResource.Meta? { get }

Methods

Method Description

getTransactions(completion:)

Get a list of transactions related with resource.
func getTransactions(completion: @escaping FMPTransactionsHandler)

Parameters:

  • completion. Closing expression containing method execution result.

copy() Get instance of builder class for copying FMPResource. It returns the instance of the FMPResource.Builder builder class.
func copy() -> FMPResource.Builder

Examples

Get list of transactions:

// Build an instance of the FMPResource class. For details see examples for FMPResource.Builder.
let resource: FMPResource = fmp.resource.build()
  
// Get list of transactions linked to resource
resource.getTransactions { (success, error, transactions) in
    if success {
        // Display list of transaction identifiers
        print(transactions.map { $0.id })
    } else {
        // Display error code and description
        print(error?.code, error?.description)
    }
}

Copy FMPResource:

// Build an instance of the FMPResource class. For details see examples for FMPResource.Builder.
let resource: FMPResource = fmp.resource.build()
  
// Copy instance of the FMPResource class.
let resourceCopy: FMPResource = resource.copy().build()

See also:

FMPWrapper Framework | Classes