diff options
Diffstat (limited to 'Hutch/Networking/SRHTService.swift')
| -rw-r--r-- | Hutch/Networking/SRHTService.swift | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Hutch/Networking/SRHTService.swift b/Hutch/Networking/SRHTService.swift new file mode 100644 index 0000000..5db06dd --- /dev/null +++ b/Hutch/Networking/SRHTService.swift @@ -0,0 +1,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" + } + } +} |
