Swiftpack.co - Qata/SwiftXMLRPC as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Qata.
Qata/SwiftXMLRPC 2.0.0
A simple XMLRPC parser using SwiftParsec
⭐️ 0
🕓 1 year ago
.package(url: "https://github.com/Qata/SwiftXMLRPC.git", from: "2.0.0")

SwiftXMLRPC

SwiftXMLRPC is a lightweight parser for XMLRPC.

Under the hood, this project uses SwiftParsec to parse XML.

All types support serialization and deserialization.

Usage

Parsing

// success(SwiftXMLRPC.XMLRPC.Response.params([SwiftXMLRPC.XMLRPC.Parameter.double(1.0)]))
print(
    XMLRPC.Response.deserialize(
        from: """
        <?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><double>1.0</double></value></param></params></methodResponse>
        """,
        sourceName: "https://examplewebsite.com/XMLRPC"
    )
)

Serialization

let xml = XMLRPC.Call(
    method: "example.method",
    params: [
        .struct(
            [ "first": .string("item"),
              "second": .array([.double(1e9)]),
              "third": .date(Date())
            ]
        )
    ]
).serialize()

Tests

Tests are writen with SwiftCheck and utilise roundtripping to catch bugs.

GitHub

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

Related Packages

Release Notes

2.0.0
1 year ago

Breaking changes

  • The int case has been renamed to int32 and is now restricted to 32 bit integers.

Additions

New extension types

  • int8
  • int16
  • int64
  • nil
  • dateTime (full ISO8601 date with -, : and optional time zone)

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