Swiftpack.co - Package - MartinMetselaar/vragen-sdk-network

Vragen SDK Network

The networking part of Vragen. Which is currently used by vragen-cli and vragen-sdk.

Installation

Swift Package Manager

Add the following as a dependency to your Package.swift.

.package(url: "https://github.com/MartinMetselaar/vragen-sdk-network.git", from: "1.1.0"),

Usage

The vragen-api contains several endpoints to create surveys, questions and answers. In this project we have related classes to help you list, create, get, update and delete these. Synchronise and asynchronise.

To fetch a survey with all its questions and answers we can use SurveyAsynchroniseNetwork (where SurveySynchroniseNetwork is the synchronise variant). The class needs to be initialised with the url of the server where you are hosting the vragen-api and the token.

let url = URL(string: "https://vragenapi.example.org")!
let token = "the-correct-token-from-your-server"
let client = SurveyAsynchroniseNetwork(server: url, token: token)
client.getWithChildren(identifier: identifier) { result in
    switch result {
        case .success(let survey): break
        case .failure(let error): break
    }
}

Github

link
Stars: 0

Used By

Total: 0

Releases

Getting results 📊 - 2020-10-17 09:05:18

Added SurveyService#results to retrieve the answered questions of a Survey

Submit Answer 🗳 - 2020-10-10 15:52:43

Add a way to submit an Answer on a Question

Better definition - 2020-09-06 13:41:12

Change identifiers from String's to UUID's because of updating vragen-api-models.

Bit by bit 🎉 - 2020-09-06 13:14:27

Networking layer that uses Moya to retrieve responses from the vragen-api.