You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Complete coverage of the GitHub Gist API: 15 gist operations and 5 gist comment operations covering CRUD, listing, forking, commit history, and starring.
4
+
5
+
New models: `Gist`, `GistFile`, `GistFileEdit`, `GistFileRename`, `GistFileDelete`, `GistCommit`, `GistChangeStatus`, and `GistComment`.
6
+
7
+
```pony
8
+
// Fetch a gist
9
+
GitHub(creds).get_gist("abc123")
10
+
.next[None]({(r: GistOrError) =>
11
+
match r
12
+
| let gist: Gist =>
13
+
for (name, file) in gist.files.values() do
14
+
env.out.print(name)
15
+
end
16
+
// Chain to further operations
17
+
gist.get_comments()
18
+
gist.star()
19
+
gist.fork()
20
+
end
21
+
})
22
+
23
+
// Create a gist
24
+
let files = recover val [("hello.py", "print('hello')")] end
25
+
CreateGist(files, creds where description = "My gist", is_public = true)
26
+
27
+
// Update a gist's files
28
+
let updates = recover val
29
+
[("old.py", GistFileEdit("new content"))
30
+
("rename.py", GistFileRename("renamed.py"))
31
+
("delete-me.py", GistFileDelete)]
32
+
end
33
+
gist.update_gist(updates)
34
+
```
35
+
36
+
This also adds three new HTTP infrastructure classes: `HTTPPatch` (PATCH with JSON response), `HTTPPut` (PUT expecting 204), and `HTTPCheck` (GET returning Bool based on status code 204/404).
`PaginatedList[A]` wraps an array of results with `prev_page()` / `next_page()` methods that return `(Promise | None)`. Pagination links are extracted from HTTP `Link` headers using the `ponylang/web_link` library (via `_ExtractPaginationLinks`). Used by `GetRepositoryLabels`, `GetOrganizationRepositories`, `GetRepositoryIssues`, and `SearchIssues`.
101
+
`PaginatedList[A]` wraps an array of results with `prev_page()` / `next_page()` methods that return `(Promise | None)`. Pagination links are extracted from HTTP `Link` headers using the `ponylang/web_link` library (via `_ExtractPaginationLinks`). Used by `GetRepositoryLabels`, `GetOrganizationRepositories`, `GetRepositoryIssues`, `SearchIssues`, `GetUserGists`, `GetPublicGists`, `GetStarredGists`, `GetUsernameGists`, `GetGistForks`, `GetGistCommits`, and `GetGistComments`.
89
102
90
103
### Auth
91
104
@@ -264,6 +277,36 @@ commonly-used categories that a GitHub API library would typically need.
Examples come in two styles: **functional** (calling operation primitives directly) and **OO** (chaining through `GitHub` and model convenience methods). Both styles produce the same results; use whichever fits your application's structure.
4
+
5
+
Each example has its own `Makefile`. Build with `make ssl=3.0.x` (or the SSL version matching your system).
6
+
7
+
## Gists
8
+
9
+
| Example | Style | Description |
10
+
|---------|-------|-------------|
11
+
|`get-gist`| Functional | Fetch a gist by ID and print its files |
12
+
|`get-gist-oo`| OO | Same as `get-gist`, using `GitHub.get_gist()`|
13
+
|`create-gist`| Functional | Create a new gist with a single file |
14
+
|`create-gist-oo`| OO | Same as `create-gist`, using `GitHub.create_gist()`|
15
+
|`list-gists`| Functional | List the authenticated user's gists with pagination |
16
+
|`list-gists-oo`| OO | Same as `list-gists`, using `GitHub.get_user_gists()`|
17
+
|`gist-comments`| Functional | List comments on a gist with pagination |
18
+
|`gist-comments-oo`| OO | Same as `gist-comments`, chaining through `Gist.get_comments()`|
19
+
|`star-gist`| Functional | Star a gist and verify it is starred |
20
+
|`star-gist-oo`| OO | Same as `star-gist`, chaining through `Gist.star()`|
21
+
22
+
## Repositories
23
+
24
+
| Example | Style | Description |
25
+
|---------|-------|-------------|
26
+
|`get-repository`| Functional | Fetch a repository by owner and name |
27
+
|`get-repository-oo`| OO | Same as `get-repository`, using `GitHub.get_repo()`|
28
+
|`get-repository-labels`| Functional | List labels for a repository with pagination |
29
+
30
+
## Issues
31
+
32
+
| Example | Style | Description |
33
+
|---------|-------|-------------|
34
+
|`get-issue`| Functional | Fetch an issue by number |
35
+
|`get-issue-oo`| OO | Same as `get-issue`, chaining through `Repository.get_issue()`|
36
+
|`get-issue-comments`| Functional | List comments on an issue |
37
+
|`get-issue-comments-oo`| OO | Same as `get-issue-comments`, chaining through `Issue.get_comments()`|
38
+
|`create-issue-comment`| Functional | Create a comment on an issue |
39
+
|`create-issue-comment-oo`| OO | Same as `create-issue-comment`, chaining through `Issue.create_comment()`|
40
+
|`search-issues`| Functional | Search issues across repositories with pagination |
41
+
42
+
## Pull Requests
43
+
44
+
| Example | Style | Description |
45
+
|---------|-------|-------------|
46
+
|`get-pull-request`| Functional | Fetch a pull request by number |
47
+
|`get-pull-request-oo`| OO | Same as `get-pull-request`, chaining through `Repository.get_pull_request()`|
48
+
|`get-pull-request-files`| Functional | List files changed in a pull request |
49
+
|`get-pull-request-files-oo`| OO | Same as `get-pull-request-files`, chaining through `PullRequest.get_files()`|
50
+
51
+
## Commits
52
+
53
+
| Example | Style | Description |
54
+
|---------|-------|-------------|
55
+
|`get-commit`| Functional | Fetch a commit by SHA |
56
+
|`get-commit-oo`| OO | Same as `get-commit`, chaining through `Repository.get_commit()`|
57
+
58
+
## Labels
59
+
60
+
| Example | Style | Description |
61
+
|---------|-------|-------------|
62
+
|`create-label`| Functional | Create a label on a repository |
63
+
|`create-label-oo`| OO | Same as `create-label`, chaining through `Repository.create_label()`|
64
+
|`delete-label`| Functional | Delete a label from a repository |
65
+
|`delete-label-oo`| OO | Same as `delete-label`, chaining through `Repository.delete_label()`|
66
+
|`standard-pony-labels`| Functional | Creates the standard set of labels used by ponylang projects |
67
+
68
+
## Releases
69
+
70
+
| Example | Style | Description |
71
+
|---------|-------|-------------|
72
+
|`create-release`| Functional | Create a release on a repository |
73
+
|`create-release-oo`| OO | Same as `create-release`, chaining through `Repository.create_release()`|
0 commit comments