Swiftpack.co - richardpiazza/DynuREST as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by richardpiazza.
richardpiazza/DynuREST 4.1
A Dynu.com IP Update API wrapper.
⭐️ 0
🕓 15 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/richardpiazza/DynuREST.git", from: "4.1")

DynuREST

A Dynu.com IP Update API wrapper.

Twitter: @richardpiazza

Face it... a REST API that responds in only text doesn't feel very modern. DynuREST translates the text responses from the Dynu.com IP Update API into proper HTTP status codes and meaningful errors.

Installation

DynuREST is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/richardpiazza/DynuREST.git", from: "3.0.0")
    ],
    ...
)

Then import the DynuREST packages wherever you'd like to use it:

import DynuREST

Usage

The DynuIPUpdater shared instance allows for sending IP information to the Dynu.com API.

let address = IPAddress.ipV4("X.X.X.X")
let response = try await DynuIPUpdater.shared.updateAddress(address, using: .basic("username", "password"))

IP address information can be obtained through any means, but DynuREST has two built-in providers:

  • IPifyClient.shared
  • IFConfigClient.shared

These both implement the IPSource protocol:

public protocol IPSource {
    func ipAddress() async throws -> IPAddress
}

DynuIPUpdater also contains a helper method which will automatically retrieve IP information from the built-in sources.

func requestIP(_ sources: [IPSource]) async -> [IPAddress]

GitHub

link
Stars: 0
Last commit: 13 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

DynuREST 4.1
15 weeks ago

This release focuses on better identifying routable trusted Global Unicast Addresses for IPv6.

What's Changed

Full Changelog: https://github.com/richardpiazza/DynuREST/compare/4.0.0...4.1

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics