Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 127 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,31 @@ let package = Package(
.library(
name: "GitHub",
targets: ["GitHub"]
)
),
.library(
name: "GitHub OAuth",
targets: ["GitHub OAuth"]
),
.library(
name: "GitHub Organizations",
targets: ["GitHub Organizations"]
),
.library(
name: "GitHub Repositories",
targets: ["GitHub Repositories"]
),
.library(
name: "GitHub Stargazers",
targets: ["GitHub Stargazers"]
),
.library(
name: "GitHub Traffic",
targets: ["GitHub Traffic"]
),
.library(
name: "GitHub Users",
targets: ["GitHub Users"]
),
],
dependencies: [
.package(
Expand All @@ -26,14 +50,45 @@ let package = Package(
url: "https://github.com/swift-primitives/swift-either-primitives.git",
branch: "main"
),
.package(
url: "https://github.com/swift-ietf/swift-rfc-3986.git",
branch: "main"
),
.package(
url: "https://github.com/swift-standards/swift-github-standard.git",
branch: "main"
)
),
],
targets: [
.target(
name: "GitHub",
dependencies: [
.target(name: "GitHub OAuth"),
.target(name: "GitHub Organizations"),
.target(name: "GitHub Repositories"),
.target(name: "GitHub Stargazers"),
.target(name: "GitHub Traffic"),
.target(name: "GitHub Users"),
]
),
.target(
name: "GitHub OAuth",
dependencies: [
.product(
name: "GitHub Standard",
package: "swift-github-standard"
)
]
),
.testTarget(
name: "GitHub OAuth Core Tests",
dependencies: [
.target(name: "GitHub OAuth"),
.product(name: "RFC 3986", package: "swift-rfc-3986"),
]
),
.target(
name: "GitHub Organizations",
dependencies: [
.product(
name: "Async Lifecycle Primitives",
Expand All @@ -43,15 +98,83 @@ let package = Package(
name: "Either Primitives",
package: "swift-either-primitives"
),
.product(
name: "GitHub Standard",
package: "swift-github-standard"
),
]
),
.testTarget(
name: "GitHub Organizations Core Tests",
dependencies: [.target(name: "GitHub Organizations")]
),
.target(
name: "GitHub Repositories",
dependencies: [
.product(
name: "GitHub Standard",
package: "swift-github-standard"
)
]
),
.testTarget(
name: "GitHub Core Tests",
dependencies: ["GitHub"]
name: "GitHub Repositories Core Tests",
dependencies: [.target(name: "GitHub Repositories")]
),
.target(
name: "GitHub Stargazers",
dependencies: [
.product(
name: "Async Lifecycle Primitives",
package: "swift-async-primitives"
),
.product(
name: "Either Primitives",
package: "swift-either-primitives"
),
.product(
name: "GitHub Standard",
package: "swift-github-standard"
),
]
),
.testTarget(
name: "GitHub Stargazers Core Tests",
dependencies: [.target(name: "GitHub Stargazers")]
),
.target(
name: "GitHub Traffic",
dependencies: [
.product(
name: "GitHub Standard",
package: "swift-github-standard"
)
]
),
.testTarget(
name: "GitHub Traffic Core Tests",
dependencies: [.target(name: "GitHub Traffic")]
),
.target(
name: "GitHub Users",
dependencies: [
.product(
name: "Async Lifecycle Primitives",
package: "swift-async-primitives"
),
.product(
name: "Either Primitives",
package: "swift-either-primitives"
),
.product(
name: "GitHub Standard",
package: "swift-github-standard"
),
]
),
.testTarget(
name: "GitHub Users Core Tests",
dependencies: [.target(name: "GitHub Users")]
),
],
swiftLanguageModes: [.v6]
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ persistence, or application policy.
| Product | Module | Purpose |
| --- | --- | --- |
| GitHub | `GitHub` | Typed one-call clients and bounded paginated traversals |
| GitHub OAuth | `GitHub_OAuth` | Authorization and token exchange |
| GitHub Organizations | `GitHub_Organizations` | Organization repository listing and bounded traversal |
| GitHub Repositories | `GitHub_Repositories` | Repository lookup and content retrieval |
| GitHub Stargazers | `GitHub_Stargazers` | Timestamped stargazer listing and bounded traversal |
| GitHub Traffic | `GitHub_Traffic` | Repository views, clones, paths, and referrers |
| GitHub Users | `GitHub_Users` | Authenticated-user profile, emails, and repository listing |

## Installation

Expand All @@ -38,6 +44,22 @@ dependencies: [
)
```

Each resource is also its own product, so a consumer that only needs one
resource can depend on it directly instead of the `GitHub` umbrella:

```swift
.target(
name: "YourTarget",
dependencies: [
.product(name: "GitHub Traffic", package: "swift-github")
]
)
```

The six per-resource products are `GitHub OAuth`, `GitHub Organizations`,
`GitHub Repositories`, `GitHub Stargazers`, `GitHub Traffic`, and
`GitHub Users` — see Products above.

## Usage

Clients are generic over their typed failure:
Expand Down Expand Up @@ -83,8 +105,10 @@ in
Aggregating views, clones, paths, and referrers into an application snapshot is
application policy and is intentionally outside this package.

No deprecated `GitHub Traffic`, `GitHub Stargazers`, or
`GitHub Repositories` compatibility products are provided.
`GitHub Traffic`, `GitHub Stargazers`, and `GitHub Repositories` are
first-class per-resource products (see Products above) that a consumer can
depend on directly. They are not deprecated compatibility shims for the
`GitHub` umbrella.

## Error Handling

Expand Down
1 change: 1 addition & 0 deletions Sources/GitHub OAuth/exports.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@_exported public import GitHub_Standard
3 changes: 3 additions & 0 deletions Sources/GitHub Organizations/exports.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@_exported public import Async_Lifecycle_Primitives
@_exported public import Either_Primitives
@_exported public import GitHub_Standard
3 changes: 1 addition & 2 deletions Sources/GitHub Repositories/exports.swift
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@_exported import GitHub_Repositories_Live
@_exported import GitHub_Shared
@_exported public import GitHub_Standard
3 changes: 3 additions & 0 deletions Sources/GitHub Stargazers/exports.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@_exported public import Async_Lifecycle_Primitives
@_exported public import Either_Primitives
@_exported public import GitHub_Standard
1 change: 1 addition & 0 deletions Sources/GitHub Traffic/exports.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@_exported public import GitHub_Standard
3 changes: 3 additions & 0 deletions Sources/GitHub Users/exports.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@_exported public import Async_Lifecycle_Primitives
@_exported public import Either_Primitives
@_exported public import GitHub_Standard
9 changes: 6 additions & 3 deletions Sources/GitHub/exports.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@_exported public import Async_Lifecycle_Primitives
@_exported public import Either_Primitives
@_exported public import GitHub_Standard
@_exported public import GitHub_OAuth
@_exported public import GitHub_Organizations
@_exported public import GitHub_Repositories
@_exported public import GitHub_Stargazers
@_exported public import GitHub_Traffic
@_exported public import GitHub_Users
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import RFC_3986
import Testing

@testable import GitHub
@testable import GitHub_OAuth

extension GitHub.OAuth {
@Suite("GitHub.OAuth.Client.Unit")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testable import GitHub
@testable import GitHub_OAuth

extension GitHub.OAuth.Fixture {
enum Failure: Swift.Error, Equatable, Sendable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testable import GitHub
@testable import GitHub_OAuth

extension GitHub.OAuth {
enum Fixture {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Testing

@testable import GitHub
@testable import GitHub_Organizations

extension GitHub.Organization.Repositories {
@Suite("GitHub.Organization.Repositories.Client.Unit")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testable import GitHub
@testable import GitHub_Organizations

extension GitHub.Organization.Repositories.Fixture {
enum Failure: Swift.Error, Equatable, Sendable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testable import GitHub
@testable import GitHub_Organizations

extension GitHub.Organization.Repositories {
enum Fixture {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Testing

@testable import GitHub
@testable import GitHub_Repositories

extension GitHub.Repository.Content {
@Suite("GitHub.Repository.Content.Client.Unit")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testable import GitHub
@testable import GitHub_Repositories

extension GitHub.Repository.Fixture {
enum Failure: Swift.Error, Equatable, Sendable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testable import GitHub
@testable import GitHub_Repositories

extension GitHub.Repository {
enum Fixture {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Testing

@testable import GitHub
@testable import GitHub_Repositories

extension GitHub.Repository.Get {
@Suite("GitHub.Repository.Get.Client.Unit")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Testing

@testable import GitHub
@testable import GitHub_Stargazers

extension GitHub.Repository.Stargazers {
@Suite("GitHub.Repository.Stargazers.Client.Unit")
Expand Down Expand Up @@ -46,7 +46,7 @@ extension GitHub.Repository.Stargazers {
size: .maximum
)
let limit: GitHub.Repository.Stargazers.Traversal.Limit
do throws(GitHub.Repository.Fixture.Failure) {
do throws(GitHub.Repository.Stargazers.Fixture.Failure) {
limit = try self.limit(pages: 2, items: 1)
} catch {
Issue.record("invalid traversal limit fixture: \(error)")
Expand Down Expand Up @@ -123,7 +123,7 @@ extension GitHub.Repository.Stargazers {
private func limit(
pages: UInt,
items: UInt
) throws(GitHub.Repository.Fixture.Failure)
) throws(GitHub.Repository.Stargazers.Fixture.Failure)
-> GitHub.Repository.Stargazers.Traversal.Limit
{
guard
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@testable import GitHub_Stargazers

extension GitHub.Repository.Stargazers.Fixture {
enum Failure: Swift.Error, Equatable, Sendable {
case unexpected
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@testable import GitHub_Stargazers

extension GitHub.Repository.Stargazers {
enum Fixture {}
}
Loading
Loading