Client

public class Client

The Client class acts as the interface for the Wing REST API. All Wing API Requests are routed through this class to apply the necessary authentication to the requests.

  • The OAuth credentials assigned to your application to access the Wing API. Used to authenticate with the Wing API in order to receive a token to use for subsequent authorized requests.

    Declaration

    Swift

    public var oauth: OAuthCredentials? = nil
  • The authorization token used to make authorized requests.

    Declaration

    Swift

    public var token: String?
  • Initializes an instance of the Client class.

    Declaration

    Swift

    public init()
  • Authenticates the client with the Wing API using the configured OAuth Client ID and Client Secret.

    Throws

    Throws:

    Declaration

    Swift

    public func authenticate(completion: @escaping (_ token: String?, _ error: Error?) -> Void)

    Parameters

    completion

    The callback closure that will be invoked upon receiving the response of the network request.

    token

    Optional. The token that is used to authenticate with the Wing API when performing authorized requests.

    error

    Optional. The error that occurred while performing the network request.

  • Creates a test session for a person with the specified patient data.

    Note: Requires token authentication to be configured.

    Throws

    Throws:

    Declaration

    Swift

    public func createTestSession(with patientData: PatientData,
                                      completion: @escaping (_ testSession: TestSession?, _ error: Error?) -> Void)

    Parameters

    patientData

    The data for the patient that the test session is being created for.

    completion

    The callback closure that will get invoked upon the request finishing.

    testSession

    The test session object that represents the created test session. (Optional)

    error

    The error that occurred while performing the network request. (Optional)

  • Retrieves the details of the test session with the specified ID.

    Note: Requires token authentication to be configured.

    Throws

    Throws:

    Declaration

    Swift

    public func retrieveTestSession(withId id: String, completion: @escaping (_ testSession: TestSession?, _ error: Error?) -> Void)

    Parameters

    id

    The identifier for the test session.

    completion

    The callback closure that will get invoked upon the request finishing.

    testSession

    The test session object that represents the retrieved test session. (Optional)

    error

    The error that occurred while performing the network request. (Optional)