Commit 9d3e116944
9d3e1169444b47bb1a657b46d4def68ca68fec61
parent: 4a65998b32
Unsigned
cmc <hello@cleberg.net> · 2026-04-02 03:29 UTC
fix copy throughout repo
Layout: unified · split
Hutch/API_REFERENCE.md
+7 −8
| @@ -1,10 +1,10 @@ |
| 1 | 1 | # Sourcehut API Reference |
| 2 | 2 | |
| 3 | | This document provides context and references for working with Sourcehut's APIs. |
| 3 | This document provides context and references for working with SourceHut's APIs. |
| 4 | 4 | |
| 5 | 5 | ## Official Documentation |
| 6 | 6 | |
| 7 | | The official Sourcehut API documentation can be found at: |
| 7 | The official SourceHut API documentation can be found at: |
| 8 | 8 | - **https://man.sr.ht** - Contains links to API reference pages for all *.sr.ht services |
| 9 | 9 | |
| 10 | 10 | ## Services and Their APIs |
| @@ -70,7 +70,7 @@ input Filter { |
| 70 | 70 | |
| 71 | 71 | ### Error Handling |
| 72 | 72 | |
| 73 | | Sourcehut APIs return GraphQL errors in the following format: |
| 73 | SourceHut APIs return GraphQL errors in the following format: |
| 74 | 74 | |
| 75 | 75 | ```json |
| 76 | 76 | { |
| @@ -107,7 +107,7 @@ Use GraphiQL interfaces available at each service's `/graphql` endpoint to: |
| 107 | 107 | |
| 108 | 108 | 1. **Filtering**: Some services may not support all filter operations. Check the schema. |
| 109 | 109 | 2. **Pagination**: Always handle `cursor` properly for pagination. |
| 110 | | 3. **Caching**: Sourcehut APIs may have aggressive caching. Use cache headers appropriately. |
| 110 | 3. **Caching**: SourceHut APIs may have aggressive caching. Use cache headers appropriately. |
| 111 | 111 | |
| 112 | 112 | ### Example Query Structure |
| 113 | 113 | |
| @@ -141,7 +141,6 @@ query { |
| 141 | 141 | |
| 142 | 142 | ## Additional Resources |
| 143 | 143 | |
| 144 | | - Sourcehut API Status: https://status.sr.ht |
| 145 | | - Sourcehut Meta (announcements): https://meta.sr.ht |
| 146 | | - Sourcehut GitHub Mirror: https://github.com/sourcehut |
| 147 | | - IRC: #sourcehut on Libera.Chat |
| \ No newline at end of file |
| 144 | - SourceHut API Status: https://status.sr.ht |
| 145 | - SourceHut Man Pages: https://man.sr.ht |
| 146 | - IRC: #sr.ht on Libera.Chat |
Hutch/Networking/SRHTClient.swift
+4 −4
| @@ -13,7 +13,7 @@ struct MultipartUploadFile: Sendable { |
| 13 | 13 | /// Placeholder type for decoding GraphQL error responses when the data shape is unknown. |
| 14 | 14 | private struct EmptyData: Decodable {} |
| 15 | 15 | |
| 16 | | /// A lightweight GraphQL client for Sourcehut services. |
| 16 | /// A lightweight GraphQL client for SourceHut services. |
| 17 | 17 | /// All requests require a personal access token set via ``token``. |
| 18 | 18 | final class SRHTClient: Sendable { |
| 19 | 19 | |
| @@ -45,10 +45,10 @@ final class SRHTClient: Sendable { |
| 45 | 45 | _token.withLock { $0 = token } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | | /// Execute a GraphQL query or mutation against a Sourcehut service. |
| 48 | /// Execute a GraphQL query or mutation against a SourceHut service. |
| 49 | 49 | /// |
| 50 | 50 | /// - Parameters: |
| 51 | | /// - service: The target Sourcehut service (determines the endpoint URL). |
| 51 | /// - service: The target SourceHut service (determines the endpoint URL). |
| 52 | 52 | /// - query: The GraphQL query or mutation string. |
| 53 | 53 | /// - variables: Optional dictionary of GraphQL variables. |
| 54 | 54 | /// - responseType: The expected `Decodable` type nested under `data`. |
| @@ -163,7 +163,7 @@ final class SRHTClient: Sendable { |
| 163 | 163 | /// graphql-multipart-request-spec (multipart/form-data). |
| 164 | 164 | /// |
| 165 | 165 | /// - Parameters: |
| 166 | | /// - service: The target Sourcehut service. |
| 166 | /// - service: The target SourceHut service. |
| 167 | 167 | /// - query: The GraphQL mutation string. |
| 168 | 168 | /// - variables: Variables dict; the file variable should be set to `nil`. |
| 169 | 169 | /// - fileVariablePath: The dot-separated path to the file variable (e.g. "input.avatar"). |
Hutch/Networking/SRHTError.swift
+1 −1
| @@ -1,6 +1,6 @@ |
| 1 | 1 | import Foundation |
| 2 | 2 | |
| 3 | | /// Errors produced by the Sourcehut GraphQL client. |
| 3 | /// Errors produced by the SourceHut GraphQL client. |
| 4 | 4 | enum SRHTError: LocalizedError, Sendable { |
| 5 | 5 | /// The server returned one or more GraphQL-level errors. |
| 6 | 6 | case graphQLErrors([GraphQLError]) |
Hutch/Networking/SRHTService.swift
+1 −1
| @@ -1,6 +1,6 @@ |
| 1 | 1 | import Foundation |
| 2 | 2 | |
| 3 | | /// Each Sourcehut service exposes its own GraphQL endpoint. |
| 3 | /// Each SourceHut service exposes its own GraphQL endpoint. |
| 4 | 4 | enum SRHTService: String, Codable, Sendable, CaseIterable { |
| 5 | 5 | case meta |
| 6 | 6 | case hub |
Hutch/Views/More/MoreView.swift
+1 −1
| @@ -36,7 +36,7 @@ struct MoreView: View { |
| 36 | 36 | } header: { |
| 37 | 37 | Text("External Links") |
| 38 | 38 | } footer: { |
| 39 | | Text("These SourceHut services are not supported in-app and open in your browser.") |
| 39 | Text("These SourceHut services are not supported in-app, as the SourceHut API does not support them, and will open in your browser.") |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | .navigationTitle("More") |
Hutch/Views/Repositories/RepositoryListView.swift
+1 −1
| @@ -217,7 +217,7 @@ private struct CreateRepositorySheet: View { |
| 217 | 217 | ProgressView() |
| 218 | 218 | .controlSize(.small) |
| 219 | 219 | } else { |
| 220 | | Text("Create Repository") |
| 220 | Text("Create") |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | .disabled(name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || viewModel.isCreatingRepository) |
Hutch/Views/Settings/SettingsView.swift
+2 −2
| @@ -713,7 +713,7 @@ private struct AboutView: View { |
| 713 | 713 | VStack(alignment: .leading, spacing: 6) { |
| 714 | 714 | Text(appName) |
| 715 | 715 | .font(.title2.weight(.semibold)) |
| 716 | | Text("A native SourceHut client for iPhone.") |
| 716 | Text("A native SourceHut client for iOS.") |
| 717 | 717 | .font(.subheadline) |
| 718 | 718 | .foregroundStyle(.secondary) |
| 719 | 719 | } |
| @@ -752,7 +752,7 @@ private struct AboutView: View { |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | Section("Acknowledgements") { |
| 755 | | Text("Built for SourceHut users who want quick access to repositories, builds, and tickets on iPhone.") |
| 755 | Text("Built for SourceHut users who want quick access to repositories, builds, and tickets on iOS.") |
| 756 | 756 | .font(.subheadline) |
| 757 | 757 | .foregroundStyle(.secondary) |
| 758 | 758 | } |