VGSCollect
public class VGSCollect
An object you use for observing VGSTextField
State
and send data to your organization vault.
-
Set your custom HTTP headers.
Declaration
Swift
public var customHeaders: [String : String]? { get set }
-
Observe only focused
VGSTextField
on editing events.Declaration
Swift
public var observeFieldState: ((_ textField: VGSTextField) -> Void)?
-
Observe all
VGSTextField
on editing events.Declaration
Swift
public var observeStates: ((_ form: [VGSTextField]) -> Void)?
-
Returns array of
VGSTextField
s associated withVGSCollect
instance.Declaration
Swift
public var textFields: [VGSTextField] { get }
-
Initialization.
Declaration
Swift
public init(id: String, environment: String, hostname: String? = nil, satellitePort: Int? = nil)
Parameters
id
String
object, your organization vault id.environment
String
object, your organization vault environment with data region.(e.g. “live”, “live-eu1”, “sandbox”).hostname
String?
object, custom Hostname, if not set, data will be sent to Vault Url. Default isnil
.satellitePort
Int?
object, custom port for satellite configuration. Default isnil
. IMPORTANT! Use only with .sandbox environment! Hostname should be specified for valid http://localhost or in local IP format http://192.168.X.X. -
Initialization.
Declaration
Swift
public convenience init(id: String, environment: Environment = .sandbox, dataRegion: String? = nil, hostname: String? = nil, satellitePort: Int? = nil)
Parameters
id
String
object, your organization vault id.environment
Environment
object, your organization vault environment. By defaultEnvironment.sandbox
.dataRegion
String
object, id of data storage region (e.g. “eu-123”).hostname
String
object, custom Hostname, if not set, data will be sent to Vault Url. Default isnil
.satellitePort
Int?
object, custom port for satellite configuration. Default isnil
. IMPORTANT! Use only with .sandbox environment! Hostname should be specified for valid http://localhost or in local IP format http://192.168.X.X.
-
Returns
VGSTextField
withVGSConfiguration.fieldName
associated withVGCollect
instance.Declaration
Swift
public func getTextField(fieldName: String) -> VGSTextField?
-
Unasubscribe
VGSTextField
fromVGSCollect
instance.Declaration
Swift
public func unsubscribeTextField(_ textField: VGSTextField)
Parameters
textField
VGSTextField
that should be unsubscribed. -
Unasubscribe
VGSTextField
s fromVGSCollect
instance.Declaration
Swift
public func unsubscribeTextFields(_ textFields: [VGSTextField])
Parameters
textFields
an array of
VGSTextField
s that should be unsubscribed. -
Unasubscribe all
VGSTextField
s fromVGSCollect
instance.Declaration
Swift
public func unsubscribeAllTextFields()
-
Detach files for associated
VGSCollect
instance.Declaration
Swift
public func cleanFiles()
-
Send data from VGSTextFields to your organization vault.
Note
Errors can be returned in the
NSURLErrorDomain
andVGSCollectSDKErrorDomain
.Declaration
Swift
public func sendData(path: String, method: VGSCollectHTTPMethod = .post, routeId: String? = nil, extraData: [String : Any]? = nil, requestOptions: VGSCollectRequestOptions = VGSCollectRequestOptions(), completion block: @escaping (VGSResponse) -> Void)
Parameters
path
Inbound rout path for your organization vault.
method
VGSCollectHTTPMethod, default is
.post
.routeId
id of VGS Proxy Route, default is
nil
.extraData
Any data you want to send together with data from VGSTextFields , default is
nil
.requestOptions
VGSCollectRequestOptions
object, holds additional request options. Default options are.nestedJSON
.completion
response completion block, returns
VGSResponse
. -
Send file to your organization vault. Only send one file at a time.
Note
Errors can be returned in the
NSURLErrorDomain
andVGSCollectSDKErrorDomain
.Declaration
Swift
public func sendFile(path: String, method: VGSCollectHTTPMethod = .post, routeId: String? = nil, extraData: [String : Any]? = nil, requestOptions: VGSCollectRequestOptions = VGSCollectRequestOptions(), completion block: @escaping (VGSResponse) -> Void)
Parameters
path
Inbound rout path for your organization vault.
method
HTTPMethod, default is
.post
.routeId
id of VGS Proxy Route, default is
nil
.extraData
Any data you want to send together with data from VGSTextFields , default is
nil
.completion
response completion block, returns
VGSResponse
. -
Send tokenization request with data from VGSTextFields.
Declaration
Swift
public func tokenizeData(routeId: String? = nil, completion block: @escaping (VGSTokenizationResponse) -> Void)
Parameters
routeId
id of VGS Proxy Route, default is
nil
.completion
response completion block, returns
VGSTokenizationResponse
.
-
Asynchronously send data from VGSTextFields to your organization vault.
Note
Errors can be returned in the
NSURLErrorDomain
andVGSCollectSDKErrorDomain
.Declaration
Swift
public func sendData(path: String, method: VGSCollectHTTPMethod = .post, routeId: String? = nil, extraData: [String : Any]? = nil, requestOptions: VGSCollectRequestOptions = VGSCollectRequestOptions()) async -> VGSResponse
Parameters
path
Inbound rout path for your organization vault.
method
VGSCollectHTTPMethod, default is
.post
.routeId
id of VGS Proxy Route, default is
nil
.extraData
Any data you want to send together with data from VGSTextFields , default is
nil
.requestOptions
VGSCollectRequestOptions
object, holds additional request options. Default options are.nestedJSON
.Return Value
-
sendFile(path:
Asynchronousmethod: routeId: extraData: ) Asynchronously send file to your organization vault. Only send one file at a time.
Note
Errors can be returned in the
NSURLErrorDomain
andVGSCollectSDKErrorDomain
.Declaration
Swift
public func sendFile(path: String, method: VGSCollectHTTPMethod = .post, routeId: String? = nil, extraData: [String : Any]? = nil) async -> VGSResponse
Parameters
path
Inbound rout path for your organization vault.
method
HTTPMethod, default is
.post
.routeId
id of VGS Proxy Route, default is
nil
.extraData
Any data you want to send together with data from VGSTextFields , default is
nil
.completion
response completion block, returns
VGSResponse
. -
tokenizeData(routeId:
Asynchronous) Asynchronously send tokenization request with data from VGSTextFields.
Declaration
Swift
public func tokenizeData(routeId: String? = nil) async -> VGSTokenizationResponse
Parameters
routeId
id of VGS Proxy Route, default is
nil
.completion
response completion block, returns
VGSTokenizationResponse
.
-
Send data from VGSTextFields to your organization vault using the Combine framework.
Note
Errors can be returned in the
NSURLErrorDomain
andVGSCollectSDKErrorDomain
.Declaration
Swift
public func sendDataPublisher(path: String, method: VGSCollectHTTPMethod = .post, routeId: String? = nil, extraData: [String : Any]? = nil, requestOptions: VGSCollectRequestOptions = VGSCollectRequestOptions()) -> Future<VGSResponse, Never>
Parameters
path
Inbound rout path for your organization vault.
method
VGSCollectHTTPMethod, default is
.post
.routeId
id of VGS Proxy Route, default is
nil
.extraData
Any data you want to send together with data from VGSTextFields , default is
nil
.requestOptions
VGSCollectRequestOptions
object, holds additional request options. Default options are.nestedJSON
.Return Value
A
Future
publisher that emits a singleVGSResponse
. -
Send file to your organization vault using the Combine framework.
Note
Errors can be returned in the
NSURLErrorDomain
andVGSCollectSDKErrorDomain
.Declaration
Swift
public func sendFilePublisher(path: String, method: VGSCollectHTTPMethod = .post, routeId: String? = nil, extraData: [String : Any]? = nil, requestOptions: VGSCollectRequestOptions = VGSCollectRequestOptions()) -> Future<VGSResponse, Never>
Parameters
path
Inbound rout path for your organization vault.
method
VGSCollectHTTPMethod, default is
.post
.routeId
id of VGS Proxy Route, default is
nil
.extraData
Any data you want to send together with data from VGSTextFields , default is
nil
.requestOptions
VGSCollectRequestOptions
object, holds additional request options. Default options are.nestedJSON
.Return Value
A
Future
publisher that emits a singleVGSResponse
. -
Send tokenization request with data from VGSTextFields to your organization vault using the Combine framework.
Note
Errors can be returned in the
NSURLErrorDomain
andVGSCollectSDKErrorDomain
.Declaration
Swift
public func tokenizeDataPublisher(routeId: String? = nil) -> Future<VGSTokenizationResponse, Never>
Parameters
routeId
id of VGS Proxy Route, default is
nil
.Return Value
A
Future
publisher that emits a singleVGSTokenizationResponse
.