CtrlHub

main

An SDK for interacting with the Ctrl Hub API in Swift
ctrl-hub/sdk.swift

CtrlHub

This swift package is an SDK for the Ctrl Hub API.

Installation

Add the package with your package manager using https://github.com/ctrl-hub/sdk.swift

Then import the package into your bundle:

import CtrlHub

Getting Started

The SDK uses a .plist configuration file called CtrlHubConfig.plist to collect all of the variables required to connect to the platform which you should add to to the root of your own project when integrating the SDK.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>authDomain</key>
    <string>https://auth.ctrl-hub.com</string>
    <key>apiDomain</key>
    <string>https://api.ctrl-hub.com</string>
</dict>
</plist>

To use the SDK, you need to import the package before calling any methods:

import CtrlHub

// Read the configuration from the CtrlHubConfig.plist in your app bundle:
if let configuration = CtrlHub.Config() {
    CtrlHub.config = configuration
} else {
    // there are errors in the config file
}

// Make requests to Ctrl Hub via the SDK:
do {
    let orgs = try await CtrlHub.Organisations.shared.Get()
} catch let error as CtrlHub.APIError {
    // handle the error
}

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

Last updated: Mon May 12 2025 21:18:51 GMT-0900 (Hawaii-Aleutian Daylight Time)