eva-sdk-ios

1.0.41 • Public • Published

EvaSdkCore

This the repository for the EVA SDK for iOS written in Swift. This library is meant to be installed with the Swift package manager

Purpose

This SDK provides the following for working with the EVA platform:

  • EVA endpoint bootstrap
  • EVA service caller
  • service definitions
  • response typings

Only the Core service definitions are included in this package. Additional definitions can be installed depending on the application need.

Installation

XCode has native support to install swift packages. The installation url is the github repository: https://github.com/springtreesolutions/eva-sdk-ios A release is just a git tag: git tag 1.0.3.

Usage

The SDK revolves around calling an EvaService on an EvaEndpoint. An endpoint should be bootstrapped once to have access to the default token and application configuration.

import os
import Combine
import EvaSdkCore

let evaEndpoint = EvaEndpoint(url: "https://api.rituals.test.eva-online.cloud");

let bootstrapPublisher = self.evaEndpoint.bootstrap()
.sink(receiveCompletion: { completion in
    switch completion {
    case .finished:
        break
    case .failure(let error):
        os_log("Bootstrap failed: %@", type: .error, "\(error)")
    }
}, receiveValue: { (listApplicationsResponse, getApplicationConfigurationResponse) in
    os_log("Bootstrap succes", type: .info)
})

All services are made available through Codable types. This base SDK supplies the Core services.

import os
import Combine
import EvaSdkCore

// Assuming a bootstrapped endpoint in this example
//
let loginService = Core.SvcLogin(endpoint: evaEndpoint)
let loginRequest = Core.Login(
    EmailAddress: 'USERNAME',
    Password: 'SECRET',
    OrganizationUnitID: 6
)

let loginPublisher = loginService.call(
    payload: loginRequest
)
.sink(receiveCompletion: { completion in
    switch completion {
    case .finished:
        break
    case .failure(let error):
        os_log("Login failed: %@", log: evaAppLog, type: .error, "\(error)")
    }
}, receiveValue: { loginResponse in
    os_log("Login success: %@", log: evaAppLog, type: .info, "\(loginResponse)")
})

Building and testing

You can use XCode and enjoy watching the beach-ball of doom a lot or you can build from the CLI using some npm scripts.

Build with npm run build which assumes a simulator called iPhone 8 to be present or npm run build:generic. You can run the XCTest suite with npm run test.

The scripts assume xcbeautify is installed for output formatting.

Updating types

This repository comes with an update script called update-eva-typings.js which can be run with NodeJS:

npm run eva-typings

Publishing

Publishing the swift package involves setting some versions in various files and pushing a git tag. An interactive npm script has been made to help with this process:

npm run release

Readme

Keywords

Package Sidebar

Install

npm i eva-sdk-ios

Weekly Downloads

0

Version

1.0.41

License

ISC

Unpacked Size

2.92 MB

Total Files

4875

Last publish

Collaborators

  • mdoeswijk