Latest 0.7.1
Homepage https://github.com/schedjoules/swift-api-client
License MIT
Platforms ios 10.0
Dependencies Alamofire, Result
Authors

Swift API Client

This repository contains the API client written in Swift, which is also used by our Swift SDK.

Usage

Currently, we support queries to retrieve a single page by an identifer, a localized home page and to search pages.

Making a request

To send a request (query in our case), first initialize an instance of SchedJoulesApiClient with your API access token.

let apiClient = SchedJoulesApiClient(accessToken: "YOUR_API_ACCESS_TOKEN")

After you have an instance, use the execute function to execute a query.

apiClient.execute(query: HomePageQuery(), completion: { result in
            switch result {
            case let .success(page):
                // Do something with the retreived page object
            case let .failure(apiError):
                print(apiError)
            }
        })

The execute function uses a completion handler which returns a Result
type. Use a switch statement to deconstruct the result.

Models

The Api Client also includes model classes. These all conform to the Decodable protocol and can be decoded from JSON data.

Latest podspec

{
    "name": "SchedJoulesApiClient",
    "version": "0.7.1",
    "summary": "The ApiClient for the SchedJoules API, written in Swift.",
    "description": "This pod contains classes which make it easier to interact with the SchedJoules API. Our SDK also uses the ApiClient, but if one does not need the full functionality of the SDK, or wants to build custom solutions instead, might find the ApiClient to be a good starting point.",
    "homepage": "https://github.com/schedjoules/swift-api-client",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Balazs Vincze": "[email protected]"
    },
    "source": {
        "git": "https://github.com/schedjoules/swift-api-client.git",
        "tag": "0.7.1"
    },
    "swift_version": "4.0",
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "ApiClient/Source/**/*.swift",
    "dependencies": {
        "Alamofire": [
            "~> 4.5"
        ],
        "Result": [
            "~> 3.0.0"
        ]
    }
}

Pin It on Pinterest

Share This