From 5ef04106c2b4ab4c3d3eeff8c13798016aefca5a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Mar 2026 02:06:47 +0000 Subject: [PATCH 1/3] chore(internal): codegen related update --- src/Core/Conversion.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Core/Conversion.php b/src/Core/Conversion.php index 17c4298..b22081d 100644 --- a/src/Core/Conversion.php +++ b/src/Core/Conversion.php @@ -170,6 +170,37 @@ private static function tryConvert(Converter|ConverterSource|string $target, mix return $value; + case 'DateTimeInterface': + case 'DateTimeImmutable': + if (is_string($value)) { + try { + ++$state->maybe; + + return new \DateTimeImmutable($value); + } catch (\Exception) { + --$state->maybe; + } + } + + ++$state->no; + + return $value; + + case 'DateTime': + if (is_string($value)) { + try { + ++$state->maybe; + + return new \DateTime($value); + } catch (\Exception) { + --$state->maybe; + } + } + + ++$state->no; + + return $value; + default: ++$state->no; From 56bebd7744e60e179eae796ab5eb41667574b92f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 16:29:34 +0000 Subject: [PATCH 2/3] feat(api): api update --- .stats.yml | 4 +- src/Content/ContentSubmitParams/Policy.php | 7 +- .../ContentSubmitParams/Policy/URLRisk.php | 93 +++++++++++++++++++ 3 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 src/Content/ContentSubmitParams/Policy/URLRisk.php diff --git a/.stats.yml b/.stats.yml index 23eb088..288e44b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 27 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-fb621278289bf54b9c00e8cadce0cc9fa89506ec908464fdb99d66620a953f0a.yml -openapi_spec_hash: c2a3e2de6f910fc28c7ccd88bf722e06 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-ad93e48ef2ee1066fe81553c7ac1f3be24037c6e1976778acb8b13baedbe5821.yml +openapi_spec_hash: 06e01ccb380f068bff3a571b58089a94 config_hash: 6b825a08e19dfb747c5dc1766502b789 diff --git a/src/Content/ContentSubmitParams/Policy.php b/src/Content/ContentSubmitParams/Policy.php index 41e3d2a..e3a83be 100644 --- a/src/Content/ContentSubmitParams/Policy.php +++ b/src/Content/ContentSubmitParams/Policy.php @@ -29,6 +29,7 @@ use ModerationAPI\Content\ContentSubmitParams\Policy\Toxicity; use ModerationAPI\Content\ContentSubmitParams\Policy\ToxicitySevere; use ModerationAPI\Content\ContentSubmitParams\Policy\URLMasking; +use ModerationAPI\Content\ContentSubmitParams\Policy\URLRisk; use ModerationAPI\Content\ContentSubmitParams\Policy\Violence; use ModerationAPI\Core\Concerns\SdkUnion; use ModerationAPI\Core\Conversion\Contracts\Converter; @@ -60,10 +61,11 @@ * @phpstan-import-type CodeAbuseShape from \ModerationAPI\Content\ContentSubmitParams\Policy\CodeAbuse * @phpstan-import-type PiiMaskingShape from \ModerationAPI\Content\ContentSubmitParams\Policy\PiiMasking * @phpstan-import-type URLMaskingShape from \ModerationAPI\Content\ContentSubmitParams\Policy\URLMasking + * @phpstan-import-type URLRiskShape from \ModerationAPI\Content\ContentSubmitParams\Policy\URLRisk * @phpstan-import-type GuidelineShape from \ModerationAPI\Content\ContentSubmitParams\Policy\Guideline * - * @phpstan-type PolicyVariants = Toxicity|PersonalInformation|ToxicitySevere|Hate|Illicit|IllicitDrugs|IllicitAlcohol|IllicitFirearms|IllicitTobacco|IllicitGambling|Cannabis|Adult|Crypto|Sexual|Flirtation|Profanity|Violence|SelfHarm|Spam|SelfPromotion|Political|Religion|CodeAbuse|PiiMasking|URLMasking|Guideline - * @phpstan-type PolicyShape = PolicyVariants|ToxicityShape|PersonalInformationShape|ToxicitySevereShape|HateShape|IllicitShape|IllicitDrugsShape|IllicitAlcoholShape|IllicitFirearmsShape|IllicitTobaccoShape|IllicitGamblingShape|CannabisShape|AdultShape|CryptoShape|SexualShape|FlirtationShape|ProfanityShape|ViolenceShape|SelfHarmShape|SpamShape|SelfPromotionShape|PoliticalShape|ReligionShape|CodeAbuseShape|PiiMaskingShape|URLMaskingShape|GuidelineShape + * @phpstan-type PolicyVariants = Toxicity|PersonalInformation|ToxicitySevere|Hate|Illicit|IllicitDrugs|IllicitAlcohol|IllicitFirearms|IllicitTobacco|IllicitGambling|Cannabis|Adult|Crypto|Sexual|Flirtation|Profanity|Violence|SelfHarm|Spam|SelfPromotion|Political|Religion|CodeAbuse|PiiMasking|URLMasking|URLRisk|Guideline + * @phpstan-type PolicyShape = PolicyVariants|ToxicityShape|PersonalInformationShape|ToxicitySevereShape|HateShape|IllicitShape|IllicitDrugsShape|IllicitAlcoholShape|IllicitFirearmsShape|IllicitTobaccoShape|IllicitGamblingShape|CannabisShape|AdultShape|CryptoShape|SexualShape|FlirtationShape|ProfanityShape|ViolenceShape|SelfHarmShape|SpamShape|SelfPromotionShape|PoliticalShape|ReligionShape|CodeAbuseShape|PiiMaskingShape|URLMaskingShape|URLRiskShape|GuidelineShape */ final class Policy implements ConverterSource { @@ -100,6 +102,7 @@ public static function variants(): array CodeAbuse::class, PiiMasking::class, URLMasking::class, + URLRisk::class, Guideline::class, ]; } diff --git a/src/Content/ContentSubmitParams/Policy/URLRisk.php b/src/Content/ContentSubmitParams/Policy/URLRisk.php new file mode 100644 index 0000000..cd1cbfe --- /dev/null +++ b/src/Content/ContentSubmitParams/Policy/URLRisk.php @@ -0,0 +1,93 @@ + */ + use SdkModel; + + /** @var 'url_risk' $id */ + #[Required] + public string $id = 'url_risk'; + + #[Required] + public bool $flag; + + #[Optional] + public ?float $threshold; + + /** + * `new URLRisk()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * URLRisk::with(flag: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new URLRisk)->withFlag(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(bool $flag, ?float $threshold = null): self + { + $self = new self; + + $self['flag'] = $flag; + + null !== $threshold && $self['threshold'] = $threshold; + + return $self; + } + + /** + * @param 'url_risk' $id + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + public function withFlag(bool $flag): self + { + $self = clone $this; + $self['flag'] = $flag; + + return $self; + } + + public function withThreshold(float $threshold): self + { + $self = clone $this; + $self['threshold'] = $threshold; + + return $self; + } +} From f90fce3613481b2cece7b8bb0c2bc177ba68e9c5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 16:30:17 +0000 Subject: [PATCH 3/3] release: 0.10.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ README.md | 2 +- src/Version.php | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6d78745..091cfb1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.9.0" + ".": "0.10.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c732896..317b673 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.10.0 (2026-03-16) + +Full Changelog: [v0.9.0...v0.10.0](https://github.com/moderation-api/sdk-php/compare/v0.9.0...v0.10.0) + +### Features + +* **api:** api update ([56bebd7](https://github.com/moderation-api/sdk-php/commit/56bebd7744e60e179eae796ab5eb41667574b92f)) + + +### Chores + +* **internal:** codegen related update ([5ef0410](https://github.com/moderation-api/sdk-php/commit/5ef04106c2b4ab4c3d3eeff8c13798016aefca5a)) + ## 0.9.0 (2026-03-03) Full Changelog: [v0.8.0...v0.9.0](https://github.com/moderation-api/sdk-php/compare/v0.8.0...v0.9.0) diff --git a/README.md b/README.md index 9f136c2..e894558 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The REST API documentation can be found on [docs.moderationapi.com](https://docs ``` -composer require "moderation-api/sdk-php 0.9.0" +composer require "moderation-api/sdk-php 0.10.0" ``` diff --git a/src/Version.php b/src/Version.php index 9441031..75cabf4 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ModerationAPI; // x-release-please-start-version -const VERSION = '0.9.0'; +const VERSION = '0.10.0'; // x-release-please-end