SudoVirtualCardsClient

public protocol SudoVirtualCardsClient : AnyObject

Client used to interface with the Sudo Payment Platform service.

It is recommended to code to this interface, rather than the implementation class (DefaultSudoVirtualCardsClient) as the implementation class is only meant to be used for initializing an instance of the client.

  • Removes all keys associated with this client, resets any cached data, cleans up subscriptions, and purges any pending operations.

    It is important to note that this will clear ALL cached data related to all sudo services.

    Declaration

    Swift

    func reset() throws

Mutations

Queries

  • Get a provisional card using the id parameter. If the card cannot be found, nil will be returned.

    • Parameters

      • id: ID of the card to be retrieved.
      • cachePolicy: Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Declaration

    Swift

    func getProvisionalCardWithId(
        _ id: String,
        cachePolicy: CachePolicy,
        completion: @escaping ClientCompletion<ProvisionalCard?>
    )

    Return Value

    • Success: Card associated with id, or nil if the card cannot be found.
    • Failure:
      • SudoPlatformError.
  • Get a list of provisional cards. If no cards can be found, an empty list will be returned.

    Declaration

    Swift

    func listProvisionalCardsWithFilter(
        _ filter: GetProvisionalCardsFilterInput?,
        limit: Int?,
        nextToken: String?,
        cachePolicy: CachePolicy,
        completion: @escaping ClientCompletion<ListOutput<ProvisionalCard>>
    )

    Parameters

    filter

    Filter to be applied to results of query.

    limit

    Number of cards to return. If nil, the limit is 10.

    nextToken

    Generated token by previous calls to getCards. This is used for pagination. This value should be pre-generated from a previous pagination call, otherwise it will throw an error. It is important to note that the same structured API call should be used if using a previously generated nextToken.

    cachePolicy

    Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Return Value

    • Success: Cards associated with user, or empty array if no card can be found.
    • Failure:
      • SudoPlatformError.
  • Get a card using the id parameter. If the card cannot be found, nil will be returned.

    • Parameters

      • filter: Filter to be applied to results of query.
      • id: ID of the card to be retrieved.
      • cachePolicy: Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Declaration

    Swift

    func getCardWithId(
        _ id: String,
        cachePolicy: CachePolicy,
        completion: @escaping ClientCompletion<Card?>
    )

    Return Value

    • Success: Card associated with id, or nil if the card cannot be found.
    • Failure:
      • SudoPlatformError.
  • Get a list of cards. If no cards can be found, an empty list will be returned.

    Declaration

    Swift

    func listCardsWithFilter(
        _ filter: GetCardsFilterInput?,
        limit: Int?,
        nextToken: String?,
        cachePolicy: CachePolicy,
        completion: @escaping ClientCompletion<ListOutput<Card>>
    )

    Parameters

    filter

    Filter to be applied to results of query.

    limit

    Number of cards to return. If nil, the limit is 10.

    nextToken

    Generated token by previous calls to getCards. This is used for pagination. This value should be pre-generated from a previous pagination call, otherwise it will throw an error. It is important to note that the same structured API call should be used if using a previously generated nextToken.

    cachePolicy

    Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Return Value

    • Success: Cards associated with user, or empty array if no card can be found.
    • Failure:
      • SudoPlatformError.
  • Get a funding source using the id parameter. If the funding source cannot be found, nil will be returned.

    Declaration

    Swift

    func getFundingSourceWithId(
        _ id: String,
        cachePolicy: CachePolicy,
        completion: @escaping ClientCompletion<FundingSource?>
    )

    Parameters

    id

    ID of the funding source to be retrieved.

    cachePolicy

    Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Return Value

    • Success: FundingSource associated with id, or nil if the funding source cannot be found.
    • Failure:
      • SudoPlatformError.
  • Get a list of funding sources. If no funding sources can be found, an empty list will be returned.

    Declaration

    Swift

    func listFundingSourcesWithLimit(
        _ limit: Int?,
        nextToken: String?,
        cachePolicy: CachePolicy,
        completion: @escaping ClientCompletion<ListOutput<FundingSource>>
    )

    Parameters

    limit

    Number of funding sources to return. If nil, the limit is 10.

    nextToken

    Generated token by previous calls to getFundingSources. This is used for pagination. This value should be pre-generated from a previous pagination call, otherwise it will throw an error. It is important to note that the same structured API call should be used if using a previously generated nextToken.

    cachePolicy

    Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Return Value

    • Success: FundingSource associated with id, or empty array if no card can be found.
    • Failure:
      • SudoPlatformError.

Methods: Transactions

  • Get a transaction using the id parameter. If the transaction cannot be found, nil will be returned.

    Declaration

    Swift

    func getTransactionWithId(
        _ id: String,
        cachePolicy: CachePolicy,
        completion: @escaping ClientCompletion<Transaction?>
    )

    Parameters

    id

    ID of the transaction to be retrieved.

    cachePolicy

    Determines how the data is fetched. When using cacheOnly, please be aware that this will only return cached results of similar exact API calls.

    Return Value

    • Success: Transaction associated with id, or nil if the card cannot be found.
    • Failure:
      • SudoPlatformError.
  • Get a list of transactions. If no transactions can be found, an empty list will be returned.

    Declaration

    Swift

    func listTransactionsWithFilter(
        _ filter: GetTransactionsFilterInput?,
        limit: Int?,
        nextToken: String?,
        cachePolicy: CachePolicy,
        completion: @escaping ClientCompletion<ListOutput<Transaction>>
    )

    Parameters

    filter

    Filter to be applied to results of query.

    limit

    Number of transaction to return. If nil, the limit is 10.

    nextToken

    Generated token by previous calls to getTransactions. This is used for pagination. This value should be pre-generated from a previous pagination call, otherwise it will throw an error.

    cachePolicy

    Determines how the data is fetched.

    Return Value

    • Success: Transactions associated with user, or empty array if no transaction can be found.
    • Failure:
      • SudoPlatformError.

Subscriptions