Skip to content

Commit 702da90

Browse files
authored
Merge pull request #114 from tayloraswift/0.6
0.6
2 parents e1fe879 + f918ef0 commit 702da90

File tree

365 files changed

+7233
-4345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+7233
-4345
lines changed

Assets/css/Div.More.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/css/Main.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/css/Main.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/css/Section.Introduction.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ let package:Package = .init(
6363
.library(name: "Swiftinit", targets: ["Swiftinit"]),
6464
.library(name: "SwiftinitAssets", targets: ["SwiftinitAssets"]),
6565
.library(name: "SwiftinitPages", targets: ["SwiftinitPages"]),
66+
.library(name: "SwiftinitPlugins", targets: ["SwiftinitPlugins"]),
6667
.library(name: "SwiftinitRender", targets: ["SwiftinitRender"]),
6768

6869
.executable(name: "SwiftinitServer", targets: ["SwiftinitServer"]),
@@ -97,7 +98,7 @@ let package:Package = .init(
9798
.package(url: "https://github.com/tayloraswift/swift-hash", .upToNextMinor(
9899
from: "0.5.0")),
99100
.package(url: "https://github.com/tayloraswift/swift-mongodb", .upToNextMinor(
100-
from: "0.10.0")),
101+
from: "0.10.1")),
101102

102103
.package(url: "https://github.com/apple/swift-atomics", .upToNextMinor(
103104
from: "1.2.0")),
@@ -399,6 +400,16 @@ let package:Package = .init(
399400
.target(name: "UnidocQueries"),
400401
]),
401402

403+
.target(name: "SwiftinitPlugins", dependencies:
404+
[
405+
.target(name: "SwiftinitRender"),
406+
.target(name: "UnidocDB"),
407+
408+
.product(name: "Atomics", package: "swift-atomics"),
409+
.product(name: "NIOPosix", package: "swift-nio"),
410+
.product(name: "NIOSSL", package: "swift-nio-ssl"),
411+
]),
412+
402413
.target(name: "SwiftinitRender", dependencies:
403414
[
404415
.target(name: "HTTP"),
@@ -573,6 +584,7 @@ let package:Package = .init(
573584
.target(name: "Sitemaps"),
574585
.target(name: "SwiftinitAssets"),
575586
.target(name: "SwiftinitPages"),
587+
.target(name: "SwiftinitPlugins"),
576588
]),
577589

578590

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22

3-
<strong><em><code>unidoc</code></em></strong><br><small><code>0.5</code></small>
3+
<strong><em><code>unidoc</code></em></strong><br><small><code>0.6</code></small>
44

55
[![ci build status](https://github.com/kelvin13/swift-unidoc/actions/workflows/build.yml/badge.svg)](https://github.com/kelvin13/swift-unidoc/actions/workflows/build.yml)
66

Sources/GitHubAPI/GitHub.API.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,21 @@ extension GitHub.OAuth
88
extension GitHub
99
{
1010
@frozen public
11-
struct API
11+
struct API<PAT>:Sendable where PAT:Sendable
1212
{
1313
public
1414
let agent:String
1515
public
1616
let oauth:GitHub.OAuth
17+
public
18+
let pat:PAT
1719

1820
@inlinable internal
19-
init(agent:String, oauth:GitHub.OAuth)
21+
init(agent:String, oauth:GitHub.OAuth, pat:PAT)
2022
{
2123
self.agent = agent
2224
self.oauth = oauth
25+
self.pat = pat
2326
}
2427
}
2528
}

Sources/GitHubAPI/GitHub.OAuth.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@ extension GitHub
2525
}
2626
extension GitHub.OAuth
2727
{
28-
/// The GitHub API.
28+
/// The GitHub REST API.
2929
@inlinable public
30-
var api:GitHub.API { .init(agent: "swift-unidoc (by tayloraswift)", oauth: self) }
30+
var api:GitHub.API<Void>
31+
{
32+
.init(agent: "swift-unidoc (by tayloraswift)", oauth: self, pat: ())
33+
}
34+
35+
/// The GitHub GraphQL API.
36+
@inlinable public
37+
func api(pat:String) -> GitHub.API<String>
38+
{
39+
.init(agent: "swift-unidoc (by tayloraswift)", oauth: self, pat: pat)
40+
}
3141
}

Sources/GitHubClient/GitHub.Client.Connection.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ extension GitHub.Client
2323
}
2424
}
2525
}
26-
extension GitHub.Client<GitHub.API>.Connection
26+
extension GitHub.Client<GitHub.API<String>>.Connection
2727
{
2828
/// Run a GraphQL API request.
2929
///
30-
/// The request will be charged to the user associated with the given token. It is not
30+
/// The request will be charged to the user associated with the stored token. It is not
3131
/// possible to run a GraphQL API request without a token.
3232
@inlinable public
3333
func post<Response>(query:String,
34-
with token:String,
3534
for _:Response.Type = Response.self) async throws -> Response
3635
where Response:JSONDecodable
3736
{
@@ -42,7 +41,7 @@ extension GitHub.Client<GitHub.API>.Connection
4241
":authority": self.http2.remote,
4342
":path": "/graphql",
4443

45-
"authorization": "Bearer \(token)",
44+
"authorization": "Bearer \(self.app.pat)",
4645

4746
// GitHub will reject the API request if the user-agent is not set.
4847
"user-agent": self.app.agent,
@@ -72,7 +71,7 @@ extension GitHub.Client<GitHub.API>.Connection
7271
if let second:String = response.headers?["x-ratelimit-reset"].first,
7372
let second:Int64 = .init(second)
7473
{
75-
throw GitHub.Client<GitHub.API>.RateLimitError.init(
74+
throw GitHub.Client<GitHub.API<String>>.RateLimitError.init(
7675
until: .second(second))
7776
}
7877
else
@@ -84,7 +83,9 @@ extension GitHub.Client<GitHub.API>.Connection
8483
throw HTTP.StatusError.init(code: response.status)
8584
}
8685
}
87-
86+
}
87+
extension GitHub.Client<GitHub.API<Void>>.Connection
88+
{
8889
/// Run a REST API request.
8990
@inlinable public
9091
func get<Response>(_:Response.Type = Response.self,
@@ -137,7 +138,7 @@ extension GitHub.Client<GitHub.API>.Connection
137138
if let second:String = response.headers?["x-ratelimit-reset"].first,
138139
let second:Int64 = .init(second)
139140
{
140-
throw GitHub.Client<GitHub.API>.RateLimitError.init(
141+
throw GitHub.Client<GitHub.API<Void>>.RateLimitError.init(
141142
until: .second(second))
142143
}
143144

0 commit comments

Comments
 (0)