Skip to content

Releases

v4.0.1 - ClubReservation accepts numeric fields

Choose a tag to compare

@AustinW AustinW released this 02 Nov 06:37
393060c

USAG sends ClubContactID, MeetContactID, ClubContactPhone and MeetContactPhone as JSON numbers. ClubReservation::fromArray() passed them unchanged into ?string parameters, so reservations()->clubs() threw a TypeError for every live sanction.

Fixed

  • Every ClubReservation text field now casts JSON numbers to strings. Empty values ('', null, 0) stay null, as before. (#6, #7)

v3.1.2 - ClubReservation accepts numeric fields

Choose a tag to compare

@AustinW AustinW released this 02 Nov 06:37

USAG sends ClubContactID, MeetContactID, ClubContactPhone and MeetContactPhone as JSON numbers. ClubReservation::fromArray() passed them unchanged into ?string parameters, so reservations()->clubs() threw a TypeError for every live sanction.

Fixed

  • Every ClubReservation text field now casts JSON numbers to strings. Empty values ('', null, 0) stay null, as before. (#6, #7)

Backport to the 3.x line (release/3.x). No breaking changes from v3.1.1.

v4.0.0 - Graceful handling of unrecognized MemberType/MemberStatus codes

Choose a tag to compare

@AustinW AustinW released this 11 Aug 06:49
b6fb03c

Breaking change

AthleteReservation, CoachReservation, JudgeReservation, GroupReservation, and VerificationResult previously used Enum::from() to parse MemberType/MemberStatus from the API, which throws \ValueError on any code the SDK doesn't enumerate. USAG's live vocabulary is wider than what's modeled — deprecated codes like PRO/JPRO are still returned in production, and the same person can get different MemberType codes from different endpoints. One unrecognized code failed the entire response collection, not just that row, and since \ValueError implements \Throwable, a consumer's catch (\Throwable) wrapper would misreport it as an API outage.

What changed:

  • ->memberType and ->status are now ?MemberType / ?MemberStatus — null when USAG returns a code this SDK doesn't model, instead of throwing.
  • DisciplineData::toEnum() now returns ?Discipline instead of throwing on an unrecognized code.
  • New memberTypeRaw / statusRaw string properties are added alongside every widened field, always populated with the original API value — so you can still see or log a code the SDK doesn't recognize yet.
  • canCompete() / canParticipate()-style methods treat a null status as "cannot compete" rather than throwing.

Migration: any code reading ->memberType or ->status (or calling DisciplineData::toEnum()) without a null check will need one — e.g. $athlete->status?->canParticipate() ?? false.

Fixes #4

Also investigated, not changed

The issue's side-note claiming RateLimitException is unreachable dead code doesn't hold up — UsaGymException::fromResponse() is called from ResolvesDtoOrThrows, which is used by all four Resources classes, so it is reachable via the normal request flow.

v3.1.0 - TrampolineApparatus enum & typed HTTP exceptions

Choose a tag to compare

@AustinW AustinW released this 31 Jul 20:14
1bd627d

Added

  • Enums\Apparatus\TrampolineApparatus (TR/DM/TU) and Discipline::apparatusEnumClass(), mirroring the existing Levels\* discipline-scoped enum convention. fromApi() accepts both the code and display form and throws on anything unrecognised; tryFromApi() is the non-throwing variant.

Fixed

  • Resources now route through resolveDto() instead of Saloon's dtoOrFail(), so failed HTTP responses raise the SDK's typed exception hierarchy (AuthenticationException, NotFoundException, ValidationException, RateLimitException, ApiException) carrying the real HTTP status, instead of a generic "unable to create DTO" error that hid it.
  • UsaGymException::fromResponse() no longer fatals when the failing response body isn't parseable JSON (e.g. an empty text/html 500).

Behavioral note

Code that previously caught \LogicException from dtoOrFail() will now receive a UsaGymException subclass instead.

Full diff: v3.0.0...v3.1.0

v2.3.0

Choose a tag to compare

@AustinW AustinW released this 01 Feb 07:25

What's Changed

  • Added Gender enum with flexible parsing for athlete gender data
  • Added gender property to AthleteReservation data class
  • Fixed composer.json for proper Packagist version detection

Full Changelog: v2.2.0...v2.3.0

v2.2.0 - PHP 8.3+ Required

Choose a tag to compare

@AustinW AustinW released this 11 Jan 06:24

Breaking Change

PHP 8.3+ is now required.

This aligns the package requirements with:

  • Pest v4 (test framework) which requires PHP 8.3+
  • CI test matrix which runs on PHP 8.3 and 8.4

If you need PHP 8.1/8.2 support, use v2.1.x.


Full Changelog: v2.1.4...v2.2.0

v2.1.4 - CI/CD & README Badges

Choose a tag to compare

@AustinW AustinW released this 11 Jan 06:07

What's New

GitHub Actions CI/CD

Added automated testing workflow that runs on every push and pull request:

  • Test Matrix: PHP 8.1, 8.2, and 8.3
  • Static Analysis: PHPStan checks

README Badges

Added status badges to the README:

Tests
Latest Version
PHP Version
License


Full Changelog: v2.1.3...v2.1.4

v2.1.3 - Fix Clubs Endpoint

Choose a tag to compare

@AustinW AustinW released this 11 Jan 06:06

Bug Fix

Fixed the clubs reservations endpoint URL:

  • Before: /sanction/{id}/reservations/club (404 error)
  • After: /sanction/{id}/reservations/clubs (works correctly)

The API documentation specifies the plural form /reservations/clubs, but the SDK was incorrectly using the singular form.


Full Changelog: v2.1.2...v2.1.3

v2.1.2 - Unique Athlete Counts & Graceful 404 Handling

Choose a tag to compare

@AustinW AustinW released this 11 Jan 05:53

What's New

Unique Athlete Counts

The usagym:test command now displays unique athletes by member ID, since athletes may have multiple registrations for different events:

Athlete Reservations: 186 unique athletes (541 registrations)

Sample athletes (first 5 unique):
┌───────────┬───────────────┬───────┬─────────────┐
│ Member ID │ Name          │ Level │ Can Compete │
├───────────┼───────────────┼───────┼─────────────┤
│ 2426288   │ Seth Astorga  │ 5     │ Yes         │
│ 2299938   │ Travis Greene │ 8     │ Yes         │
...

Graceful Handling of Unavailable Endpoints

The clubs endpoint returns 404 for some sanction types (e.g., MAG). This is now handled gracefully with a "SKIP" status instead of failing:

Club reservations endpoint not available for this sanction type.

+----------------------+--------+------------------------------------------------+
| Test                 | Status | Details                                        |
+----------------------+--------+------------------------------------------------+
| Club Reservations    | SKIP   | Endpoint not available for this sanction type  |
...

Full Changelog: v2.1.1...v2.1.2

v2.1.1 - Debug Flag & Improved Error Handling

Choose a tag to compare

@AustinW AustinW released this 11 Jan 05:45

What's New

Debug Mode

Added --debug flag to the usagym:test command for troubleshooting API connection issues:

php artisan usagym:test --debug

Shows detailed request/response information:

  • HTTP method and URL
  • Request headers (Authorization header partially masked)
  • Response status code
  • Response headers
  • Response body (first 500 characters)

Improved Error Handling

  • Better error messages when API requests fail
  • Shows actual HTTP status code and response body
  • Catches all exceptions to prevent uncaught errors

Full Changelog: v2.1.0...v2.1.1