Response

public struct Response: GeneratorType, ArrayLiteralConvertible

Response

Response object is created out of the JSON response of the judo API for seamless handling of values returned in any call.

The response object can hold multiple transaction objects and supports pagination if available.

In most cases (successful Payment, Pre-auth or RegisterCard operation) a Response object will hold one TransactionData object. Supporting CollectionType protocol, you can access the elements by subscripting let transactionData = response[0] or using the available variable response.first as a more readable approach.

  • The current pagination response

    Declaration

    Swift

    public let pagination: Pagination?
  • The array that contains the transaction response objects

    Declaration

    Swift

    public private (set) var items = [TransactionData]()
  • Helper to count in case of Generation of elements for loops

    Declaration

    Swift

    public var indexInSequence = 0
  • Convenience initializer for ArrayLiteralConvertible support

    Declaration

    Swift

    public init(arrayLiteral elements: TransactionData...)

    Parameters

    elements

    elements in a sequential type

    Return Value

    a Response object

  • Add an element on to the items

    Parameter

    Parameter element: the element to add to the items Array

    Declaration

    Swift

    public mutating func append(element: TransactionData)

    Parameters

    element

    the element to add to the items Array

  • Calculate the next page from available data

    Returns

    a newly calculated Pagination object based on the Response object

    Declaration

    Swift

    public func nextPage() -> Pagination?

    Return Value

    a newly calculated Pagination object based on the Response object

  • GeneratorType method to aid when using the object in a loop

    Declaration

    Swift

    public mutating func next() -> TransactionData?

    Return Value

    generated next element

  • start index of the sequence

    Declaration

    Swift

    public var startIndex: Int
  • end index of the sequence

    Declaration

    Swift

    public var endIndex: Int
  • generator for the TransactionData type

    Declaration

    Swift

    public func generate() -> IndexingGenerator<[TransactionData]>

    Return Value

    an IndexingGenerator object