Skip to content

mattmassicotte/NodeInfo

Build Status Platforms Documentation Matrix

NodeInfo

A NodeInfo library for Swift.

This is an implementation of the NodeInfo protocol. Currently supports versions 2.1 and 2.0, but open up an issue if you need something else and I'll try to add it!

Integration

dependencies: [
    .package(url: "https://github.com/mattmassicotte/NodeInfo", branch: "main")
]

Usage

import NodeInfo

// decode
let document = try JSONDecoder().decode(NodeInfo_2_0.Document.self, from: nodeInfoData)

print(document.software)

// encode
let document = NodeInfo_2_1.Document(
    software: NodeInfo_2_1.Software(name: "system", version: "1.0", repository: "some_repo", homepage: "some_site"),
    protocols: [.xmpp],
    services: NodeInfo_2_1.Services(inbound: [.pop3], outbound: [.blogger]),
    openRegistrations: false,
    usage: NodeInfo_2_1.Usage(
        users: NodeInfo_2_1.Usage.Users(
            total: 5,
            activeHalfyear: 4,
            activeMonth: 3
        ),
        localPosts: 40,
        localComments: 50
    )
)

let data = try JSONEncoder().encode(document)

Contributing and Collaboration

I would love to hear from you! Issues or pull requests work great. Both a Matrix space and Discord are available for live help, but I have a strong bias towards answering in the form of documentation. You can also find me on the web.

I prefer collaboration, and would love to find ways to work together if you have a similar project.

I prefer indentation with tabs for improved accessibility. But, I'd rather you use the system you want and make a PR than hesitate because of whitespace.

By participating in this project you agree to abide by the Contributor Code of Conduct.

About

A NodeInfo library for Swift

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Languages