summaryrefslogtreecommitdiff
path: root/Hutch/Networking/SRHTService.swift
blob: 5db06dd007aa888c65229150b7d831f1419e53c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import Foundation

/// Each Sourcehut service exposes its own GraphQL endpoint.
enum SRHTService: String, Codable, Sendable, CaseIterable {
    case meta
    case git
    case hg
    case builds
    case lists
    case todo
    case paste
    case pages
    case man

    /// The GraphQL endpoint URL for this service.
    var url: URL {
        // Force-unwrap is safe here — these are compile-time constant strings.
        URL(string: "https://\(rawValue).sr.ht/query")!
    }

    var displayName: String {
        switch self {
        case .meta:   "Meta"
        case .git:    "Git"
        case .hg:     "Mercurial"
        case .builds: "Builds"
        case .lists:  "Lists"
        case .todo:   "Todo"
        case .paste:  "Paste"
        case .pages:  "Pages"
        case .man:    "Man"
        }
    }
}