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
27 changes: 24 additions & 3 deletions .github/workflows/breakage-against-ponyc-latest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test against ponyc nightly
name: ponyc update breakage test

on:
repository_dispatch:
Expand All @@ -8,8 +8,29 @@ permissions:
packages: read

jobs:
vs-latest-ponyc:
name: Verify main against the latest ponyc
pony-lint:
name: Lint against ponyc main
runs-on: ubuntu-latest
container:
image: ghcr.io/ponylang/shared-docker-ci-standard-builder:nightly
steps:
- uses: actions/checkout@v6.0.2
- name: Lint
run: make lint
- name: Send alert on failure
if: ${{ failure() }}
uses: zulip/github-actions-zulip/send-message@bd8ec52de371d139ae8313661b7d8318c19266aa
with:
api-key: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_API_KEY }}
email: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_EMAIL }}
organization-url: 'https://ponylang.zulipchat.com/'
to: notifications
type: stream
topic: ${{ github.repository }} scheduled job failure
content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.

vs-ponyc-latest:
name: Test against ponyc main
runs-on: ubuntu-latest
container:
image: ghcr.io/ponylang/shared-docker-ci-standard-builder-with-openssl-3.6.2:nightly
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/pony-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: pony-lint

on:
pull_request:
paths:
- '**/*.pony'

concurrency:
group: pony-lint-${{ github.ref }}
cancel-in-progress: true

permissions:
packages: read

jobs:
pony-lint:
name: Lint Pony source
runs-on: ubuntu-latest
container:
image: ghcr.io/ponylang/shared-docker-ci-standard-builder:release
steps:
- uses: actions/checkout@v6.0.2
- name: Lint
run: make lint
48 changes: 46 additions & 2 deletions .release-notes/next-release.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,48 @@
## Update to work with Pony 0.69.1
## Require Pony 0.69.1

Pony 0.69.1 is the new minimum required version.
Pony 0.69.1 is the new minimum required version. The `json` standard library package renamed its types from `Json*` to `JSON*` in this release, and all public types in this library have been updated to match.

## Rename Json to JSON in public type names

All public types that had `Json` in their name now use `JSON` to follow Pony's acronym casing convention. This affects every converter primitive, the two paginated converter classes, and `LinkedJSONRequester`.

Before:

```pony
let converter = RepositoryJsonConverter
```

After:

```pony
let converter = RepositoryJSONConverter
```

The full list of renamed types:

- `AssetJsonConverter` → `AssetJSONConverter`
- `CommitJsonConverter` → `CommitJSONConverter`
- `CommitFileJsonConverter` → `CommitFileJSONConverter`
- `GistJsonConverter` → `GistJSONConverter`
- `GistChangeStatusJsonConverter` → `GistChangeStatusJSONConverter`
- `GistCommentJsonConverter` → `GistCommentJSONConverter`
- `GistCommitJsonConverter` → `GistCommitJSONConverter`
- `GistFileJsonConverter` → `GistFileJSONConverter`
- `GitCommitJsonConverter` → `GitCommitJSONConverter`
- `GitPersonJsonConverter` → `GitPersonJSONConverter`
- `IssueJsonConverter` → `IssueJSONConverter`
- `IssueCommentJsonConverter` → `IssueCommentJSONConverter`
- `IssueCommentsJsonConverter` → `IssueCommentsJSONConverter`
- `IssuePullRequestJsonConverter` → `IssuePullRequestJSONConverter`
- `LabelJsonConverter` → `LabelJSONConverter`
- `LicenseJsonConverter` → `LicenseJSONConverter`
- `PullRequestJsonConverter` → `PullRequestJSONConverter`
- `PullRequestBaseJsonConverter` → `PullRequestBaseJSONConverter`
- `PullRequestFilesJsonConverter` → `PullRequestFilesJSONConverter`
- `ReleaseJsonConverter` → `ReleaseJSONConverter`
- `RepositoryJsonConverter` → `RepositoryJSONConverter`
- `UserJsonConverter` → `UserJSONConverter`
- `PaginatedListJsonConverter` → `PaginatedListJSONConverter`
- `PaginatedSearchJsonConverter` → `PaginatedSearchJSONConverter`
- `LinkedJsonRequester` → `LinkedJSONRequester`

3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ make unit-tests ssl=3.0.x # unit tests only
make test-one t=TestName ssl=3.0.x # run a single test by name
make examples ssl=3.0.x # build examples only
make config=debug ssl=3.0.x # debug build
make lint # run pony-lint (no ssl= needed)
make clean # clean build artifacts + corral deps
```

`ssl=` is required on every build and test target, set to your installed TLS library: `3.0.x` or `1.1.x`. `make` runs `corral fetch` before compiling.

## Architecture

Every API operation returns `Promise[(T | RequestError)]`. An operation primitive (for example `GetRepository`) builds the URL by RFC 6570 template expansion (`ponylang/uri`), then hands off to a short-lived request actor — `JsonRequester`, `NoContentRequester`, or `CheckRequester` in the `request/` subpackage — that owns a `courier` HTTP connection; the response is turned into a model by a `JsonConverter[T]`, and the promise is fulfilled with the model or a `RequestError`. Paginated results come back as `PaginatedList[A]`, whose `prev_page()`/`next_page()` fetch through `LinkedJsonRequester`, following the HTTP `Link` header (parsed by `ponylang/web_link`).
Every API operation returns `Promise[(T | RequestError)]`. An operation primitive (for example `GetRepository`) builds the URL by RFC 6570 template expansion (`ponylang/uri`), then hands off to a short-lived request actor — `JSONRequester`, `NoContentRequester`, or `CheckRequester` in the `request/` subpackage — that owns a `courier` HTTP connection; the response is turned into a model by a `JSONConverter[T]`, and the promise is fulfilled with the model or a `RequestError`. Paginated results come back as `PaginatedList[A]`, whose `prev_page()`/`next_page()` fetch through `LinkedJSONRequester`, following the HTTP `Link` header (parsed by `ponylang/web_link`).

The `request/` subpackage is self-contained HTTP infrastructure — it imports nothing from the parent package.

Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ All notable changes to this project will be documented in this file. This projec

### Changed

- Update to work with Pony 0.69.1 ([PR #146](https://github.com/ponylang/github_rest_api/pull/146))
- Require Pony 0.69.1 ([PR #146](https://github.com/ponylang/github_rest_api/pull/146))
- Rename Json to JSON in public type names ([PR #147](https://github.com/ponylang/github_rest_api/pull/147))

## [0.8.0] - 2026-08-07

Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ GET_DEPENDENCIES_WITH := corral fetch
CLEAN_DEPENDENCIES_WITH := corral clean
COMPILE_WITH := corral run -- ponyc
BUILD_DOCS_WITH := corral run -- pony-doc
LINT_WITH := corral run -- pony-lint

BUILD_DIR ?= build/$(config)
SRC_DIR := $(PACKAGE)
Expand All @@ -24,7 +25,7 @@ else
PONYC = $(COMPILE_WITH) --debug
endif

ifeq (,$(filter $(MAKECMDGOALS),clean docs realclean TAGS))
ifeq (,$(filter $(MAKECMDGOALS),clean docs lint realclean TAGS))
ifeq ($(ssl), 3.0.x)
SSL = -Dopenssl_3.0.x
else ifeq ($(ssl), 1.1.x)
Expand Down Expand Up @@ -66,6 +67,10 @@ _build_examples: $(EXAMPLES_BINARIES)
$(EXAMPLES_BINARIES): $(BUILD_DIR)/%: $(SOURCE_FILES) $(EXAMPLES_SOURCE_FILES) | $(BUILD_DIR)
BUILD_DIR=$(mkfile_path)$(BUILD_DIR) $(MAKE) -C $(EXAMPLES_DIR)/$*

lint:
$(GET_DEPENDENCIES_WITH)
$(LINT_WITH) .

clean:
$(CLEAN_DEPENDENCIES_WITH)
rm -rf $(BUILD_DIR)
Expand All @@ -85,4 +90,4 @@ all: test
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)

.PHONY: all examples _build_examples clean fetch TAGS test test-one
.PHONY: all examples _build_examples clean fetch lint TAGS test test-one
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ Additional API surface and functionality will be added as needed. If you need fu
```pony
use "github_rest_api"
use "github_rest_api/request"
use "net"
use lori = "lori"

actor Main
new create(env: Env) =>
let auth = TCPConnectAuth(env.root)
let auth = lori.TCPConnectAuth(env.root)
let creds = Credentials(auth, "your-github-token")

GitHub(creds).get_repo("ponylang", "ponyc")
.next[None](PrintRepository~apply(env.out))

primitive PrintRepository
fun apply(out: OutStream, result: RepositoryOrError) =>
match result
match \exhaustive\ result
| let repo: Repository =>
out.print(repo.full_name)
| let err: RequestError =>
Expand Down
4 changes: 4 additions & 0 deletions examples/create-gist-oo/create_gist_oo.pony
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
Demonstrates creating a GitHub gist using the GitHub object convenience
method.
"""
66 changes: 41 additions & 25 deletions examples/create-gist-oo/main.pony
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,66 @@ use lori = "lori"
actor Main
new create(env: Env) =>
try
// ----- CLI setup
let cs =
CommandSpec.leaf("create-gist-oo",
CommandSpec.leaf(
"create-gist-oo",
"Create a new gist with a single file",
[
OptionSpec.string("filename", "Name of the file to create")
OptionSpec.string("content", "Content of the file")
OptionSpec.string("description",
OptionSpec.string(
"filename",
"Name of the file to create")
OptionSpec.string(
"content",
"Content of the file")
OptionSpec.string(
"description",
"Description of the gist"
where default' = "")
OptionSpec.bool("public",
OptionSpec.bool(
"public",
"Whether the gist should be public"
where default' = false)
OptionSpec.string("token", "GitHub personal access token")
OptionSpec.string(
"token",
"GitHub personal access token")
]
)? .> add_help()?

let cmd = match \exhaustive\ CommandParser(cs).parse(env.args, env.vars)
| let c: Command =>
c
| let ch: CommandHelp =>
ch.print_help(env.out)
return
| let se: SyntaxError =>
env.err.print(se.string())
env.exitcode(1)
return
end
let cmd =
match \exhaustive\ CommandParser(cs).parse(
env.args, env.vars)
| let c: Command =>
c
| let ch: CommandHelp =>
ch.print_help(env.out)
return
| let se: SyntaxError =>
env.err.print(se.string())
env.exitcode(1)
return
end

let filename = cmd.option("filename").string()
let content = cmd.option("content").string()
let description = cmd.option("description").string()
let is_public = cmd.option("public").bool()
let token = cmd.option("token").string()

// ----- Create gist
let auth = lori.TCPConnectAuth(env.root)
let creds = Credentials(auth, token)

let files = recover val
let f = Array[(String, String)]
f.push((filename, content))
f
end
let files =
recover val
Array[(String, String)]
.> push((filename, content))
end

let desc: (String | None) =
if description.size() > 0 then description else None end
if description.size() > 0 then
description
else
None
end

GitHub(creds).create_gist(files, desc, is_public)
.next[None](PrintGist~apply(env.out))
Expand All @@ -61,6 +74,9 @@ actor Main
end

primitive PrintGist
"""
Prints gist details to the given output stream.
"""
fun apply(out: OutStream, g: GistOrError) =>
match \exhaustive\ g
| let gist: Gist =>
Expand Down
3 changes: 3 additions & 0 deletions examples/create-gist/create_gist.pony
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Demonstrates creating a GitHub gist using the CreateGist operation.
"""
Loading
Loading