Skip to content

Commit 2f0cc7d

Browse files
Rewrite with full Replicate API coverage and Saloon v4
- Upgrade saloonphp/saloon v3 → v4, PHP 8.1 → 8.2+ - Add all Replicate API endpoints: models, deployments, trainings, files, collections, hardware, webhooks, account - Fix auth to Bearer token, fix cancel endpoint URL bug, fix list DTO null safety - Reorganize into resource subdirectories with typed DTOs - Update README, LICENSE, CHANGELOG for independent package
1 parent 1313881 commit 2f0cc7d

73 files changed

Lines changed: 2722 additions & 532 deletions

Some content is hidden

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

.gitattributes

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
/art export-ignore
2-
/docs export-ignore
31
/tests export-ignore
4-
/scripts export-ignore
52
/.github export-ignore
6-
/.php_cs export-ignore
73
.editorconfig export-ignore
84
.gitattributes export-ignore
95
.gitignore export-ignore
106
phpstan.neon.dist export-ignore
117
phpunit.xml.dist export-ignore
128
CHANGELOG.md export-ignore
139
CONTRIBUTING.md export-ignore
14-
README.md export-ignore

.github/FUNDING.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/formats.yml

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,26 @@ on: ['push', 'pull_request']
44

55
jobs:
66
ci:
7-
runs-on: ${{ matrix.os }}
7+
runs-on: ubuntu-latest
88

9-
strategy:
10-
fail-fast: true
11-
matrix:
12-
os: [ubuntu-latest]
13-
php: [8.2]
14-
dependency-version: [prefer-stable]
15-
16-
name: Formats P${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}
9+
name: Lint & Static Analysis
1710

1811
steps:
19-
2012
- name: Checkout
21-
uses: actions/checkout@v2
22-
23-
- name: Cache dependencies
24-
uses: actions/cache@v1
25-
with:
26-
path: ~/.composer/cache/files
27-
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
13+
uses: actions/checkout@v4
2814

2915
- name: Setup PHP
3016
uses: shivammathur/setup-php@v2
3117
with:
32-
php-version: ${{ matrix.php }}
18+
php-version: '8.2'
3319
extensions: dom, mbstring, zip
34-
tools: prestissimo
35-
coverage: pcov
20+
coverage: none
3621

37-
- name: Install Composer dependencies
38-
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist
22+
- name: Install dependencies
23+
run: composer install --no-interaction --prefer-dist
3924

40-
- name: Coding Style Checks
25+
- name: Coding Style
4126
run: composer test:lint
4227

43-
- name: Type Checks
28+
- name: Static Analysis
4429
run: composer test:types

.github/workflows/tests.yml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,17 @@ on: ['push', 'pull_request']
44

55
jobs:
66
ci:
7-
runs-on: ${{ matrix.os }}
7+
runs-on: ubuntu-latest
88
strategy:
99
fail-fast: true
1010
matrix:
11-
os: [ubuntu-latest]
12-
php: [8.2, 8.1]
13-
dependency-version: [prefer-stable]
11+
php: ['8.2', '8.3', '8.4']
1412

15-
name: Tests P${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }}
13+
name: PHP ${{ matrix.php }}
1614

1715
steps:
18-
1916
- name: Checkout
20-
uses: actions/checkout@v2
21-
22-
- name: Cache dependencies
23-
uses: actions/cache@v1
24-
with:
25-
path: ~/.composer/cache/files
26-
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
17+
uses: actions/checkout@v4
2718

2819
- name: Setup PHP
2920
uses: shivammathur/setup-php@v2
@@ -32,8 +23,8 @@ jobs:
3223
extensions: dom, mbstring, zip
3324
coverage: none
3425

35-
- name: Install Composer dependencies
36-
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist
26+
- name: Install dependencies
27+
run: composer install --no-interaction --prefer-dist
3728

38-
- name: Integration Tests
39-
run: php ./vendor/bin/pest
29+
- name: Run tests
30+
run: vendor/bin/pest

CHANGELOG.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,44 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](http://keepachangelog.com/)
56
and this project adheres to [Semantic Versioning](http://semver.org/).
67

7-
## [Unreleased]
8-
- Adds first version
8+
## [1.0.0] - 2026-03-29
9+
10+
### Changed
11+
- Upgraded to Saloon v4 (patches CVE-2026-33942, CVE-2026-33182, CVE-2026-33183)
12+
- Bumped minimum PHP version to 8.2
13+
- Authentication now uses Bearer token (was Token prefix)
14+
- Reorganized requests into subdirectory structure per resource
15+
- Resources now extend Saloon's BaseResource
16+
- All DTOs use readonly properties with proper type narrowing
17+
- Updated dev dependencies: Pest v3, PHPStan v2, symfony/var-dumper v7
18+
- Updated CI workflows for PHP 8.2/8.3/8.4
19+
20+
### Added
21+
- Models resource: list, get, create, update, delete, createPrediction
22+
- Model versions: getVersion, listVersions, deleteVersion
23+
- Deployments resource: list, get, create, update, delete, createPrediction
24+
- Trainings resource: list, get, create, cancel
25+
- Files resource: list, get, upload, delete
26+
- Collections resource: list, get
27+
- Hardware resource: list
28+
- Webhooks resource: getSecret
29+
- Account resource: get
30+
- Prediction cancel endpoint (was orphaned in previous version)
31+
- Synchronous predictions via `wait` parameter (Prefer: wait header)
32+
- Streaming support via `stream` parameter
33+
- Webhook support directly on create methods
34+
- 17 typed DTOs covering every API response
35+
- `fromArray()` static factory on entity DTOs for nested construction
36+
37+
### Fixed
38+
- Trailing newline in PostPredictionCancel endpoint URL
39+
- PredictionsData reading `model` from wrong JSON level
40+
- Missing null-coalescing on nullable fields in list responses
41+
42+
### Removed
43+
- Custom Resource base class (replaced by Saloon's BaseResource)
44+
- Mutable webhook state on PredictionsResource (replaced by direct parameters)

LICENSE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
The MIT License (MIT)
22

3+
Copyright (c) Marcelo Pereira <diagngo@gmail.com>
34
Copyright (c) Ben Bjurstrom <bbjurstrom@gmail.com>
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy

0 commit comments

Comments
 (0)