diff options
| author | Christian Cleberg <[email protected]> | 2026-03-17 23:19:43 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-03-17 23:19:43 -0500 |
| commit | 32ad6cab8d58d99ebd8a28e8fa6e6f4e587cb1e5 (patch) | |
| tree | ee36d421d704e508d5617d803b4c8cbdb4804fe1 /Hutch/Networking/SRHTService.swift | |
| parent | 8f2057c53e9009c2529c9c4849c914666c0e4b40 (diff) | |
| download | hutch-32ad6cab8d58d99ebd8a28e8fa6e6f4e587cb1e5.tar.gz hutch-32ad6cab8d58d99ebd8a28e8fa6e6f4e587cb1e5.tar.bz2 hutch-32ad6cab8d58d99ebd8a28e8fa6e6f4e587cb1e5.zip | |
v1.0
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" + } + } +} |
