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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.1"
".": "0.2.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 27
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-00998c942fa9c81cb927833a3ebb681744bf59757610d9e6ce64ecf71ff2c13e.yml
openapi_spec_hash: 73a0d08c06aa948c82999fe0bca9a5e9
config_hash: d3a21c98941e21d1937472ca25c37abb
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-3eaa6a0657e9f67ea196c65d3b604c71f5406108983981ec696642563fda0a93.yml
openapi_spec_hash: c417a44bb9fa62a02eca68bbb307c712
config_hash: 6a52f6ae7d55cf3b4e91538cc7752aeb
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.2.0 (2025-12-06)

Full Changelog: [v0.1.1...v0.2.0](https://github.com/moderation-api/sdk-php/compare/v0.1.1...v0.2.0)

### Features

* allow both model class instances and arrays in setters ([1274a2b](https://github.com/moderation-api/sdk-php/commit/1274a2bd53a9f15182101eec6c3859936d03c36d))
* **api:** api update ([8d25646](https://github.com/moderation-api/sdk-php/commit/8d25646629a65b87ea31fccc053f2b4f45d13a2c))

## 0.1.1 (2025-12-05)

Full Changelog: [v0.1.0...v0.1.1](https://github.com/moderation-api/sdk-php/compare/v0.1.0...v0.1.1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The REST API documentation can be found on [docs.moderationapi.com](https://docs
<!-- x-release-please-start-version -->

```
composer require "moderation-api/sdk-php 0.1.1"
composer require "moderation-api/sdk-php 0.2.0"
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -e
cd -- "$(dirname -- "$0")/.."

echo "==> Running PHPStan"
exec -- ./vendor/bin/phpstan analyse --memory-limit=2G
exec -- ./vendor/bin/phpstan analyse --memory-limit=12G
32 changes: 19 additions & 13 deletions src/Account/AccountListResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,24 @@ public function __construct()
* Construct an instance from the required parameters.
*
* You must use named parameters to construct any parameters with a default value.
*
* @param CurrentProject|array{id: string, name: string} $current_project
*/
public static function with(
string $id,
string $paid_plan_name,
float $remaining_quota,
float $text_api_quota,
?CurrentProject $current_project = null,
CurrentProject|array|null $current_project = null,
): self {
$obj = new self;

$obj->id = $id;
$obj->paid_plan_name = $paid_plan_name;
$obj->remaining_quota = $remaining_quota;
$obj->text_api_quota = $text_api_quota;
$obj['id'] = $id;
$obj['paid_plan_name'] = $paid_plan_name;
$obj['remaining_quota'] = $remaining_quota;
$obj['text_api_quota'] = $text_api_quota;

null !== $current_project && $obj->current_project = $current_project;
null !== $current_project && $obj['current_project'] = $current_project;

return $obj;
}
Expand All @@ -109,7 +111,7 @@ public static function with(
public function withID(string $id): self
{
$obj = clone $this;
$obj->id = $id;
$obj['id'] = $id;

return $obj;
}
Expand All @@ -120,7 +122,7 @@ public function withID(string $id): self
public function withPaidPlanName(string $paidPlanName): self
{
$obj = clone $this;
$obj->paid_plan_name = $paidPlanName;
$obj['paid_plan_name'] = $paidPlanName;

return $obj;
}
Expand All @@ -131,7 +133,7 @@ public function withPaidPlanName(string $paidPlanName): self
public function withRemainingQuota(float $remainingQuota): self
{
$obj = clone $this;
$obj->remaining_quota = $remainingQuota;
$obj['remaining_quota'] = $remainingQuota;

return $obj;
}
Expand All @@ -142,15 +144,19 @@ public function withRemainingQuota(float $remainingQuota): self
public function withTextAPIQuota(float $textAPIQuota): self
{
$obj = clone $this;
$obj->text_api_quota = $textAPIQuota;
$obj['text_api_quota'] = $textAPIQuota;

return $obj;
}

public function withCurrentProject(CurrentProject $currentProject): self
{
/**
* @param CurrentProject|array{id: string, name: string} $currentProject
*/
public function withCurrentProject(
CurrentProject|array $currentProject
): self {
$obj = clone $this;
$obj->current_project = $currentProject;
$obj['current_project'] = $currentProject;

return $obj;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Account/AccountListResponse/CurrentProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public static function with(string $id, string $name): self
{
$obj = new self;

$obj->id = $id;
$obj->name = $name;
$obj['id'] = $id;
$obj['name'] = $name;

return $obj;
}
Expand All @@ -68,7 +68,7 @@ public static function with(string $id, string $name): self
public function withID(string $id): self
{
$obj = clone $this;
$obj->id = $id;
$obj['id'] = $id;

return $obj;
}
Expand All @@ -79,7 +79,7 @@ public function withID(string $id): self
public function withName(string $name): self
{
$obj = clone $this;
$obj->name = $name;
$obj['name'] = $name;

return $obj;
}
Expand Down
54 changes: 30 additions & 24 deletions src/Actions/ActionCreateParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
* freeText?: bool,
* key?: string|null,
* position?: Position|value-of<Position>,
* possibleValues?: list<PossibleValue>,
* possibleValues?: list<PossibleValue|array{value: string}>,
* queueBehaviour?: QueueBehaviour|value-of<QueueBehaviour>,
* type?: null|Type|value-of<Type>,
* valueRequired?: bool,
* webhooks?: list<Webhook>,
* webhooks?: list<Webhook|array{
* name: string, url: string, id?: string|null, description?: string|null
* }>,
* }
*/
final class ActionCreateParams implements BaseModel
Expand Down Expand Up @@ -150,10 +152,12 @@ public function __construct()
*
* @param list<string> $filterInQueueIds
* @param Position|value-of<Position> $position
* @param list<PossibleValue> $possibleValues
* @param list<PossibleValue|array{value: string}> $possibleValues
* @param QueueBehaviour|value-of<QueueBehaviour> $queueBehaviour
* @param Type|value-of<Type>|null $type
* @param list<Webhook> $webhooks
* @param list<Webhook|array{
* name: string, url: string, id?: string|null, description?: string|null
* }> $webhooks
*/
public static function with(
string $name,
Expand All @@ -171,19 +175,19 @@ public static function with(
): self {
$obj = new self;

$obj->name = $name;
$obj['name'] = $name;

null !== $builtIn && $obj->builtIn = $builtIn;
null !== $description && $obj->description = $description;
null !== $filterInQueueIds && $obj->filterInQueueIds = $filterInQueueIds;
null !== $freeText && $obj->freeText = $freeText;
null !== $key && $obj->key = $key;
null !== $builtIn && $obj['builtIn'] = $builtIn;
null !== $description && $obj['description'] = $description;
null !== $filterInQueueIds && $obj['filterInQueueIds'] = $filterInQueueIds;
null !== $freeText && $obj['freeText'] = $freeText;
null !== $key && $obj['key'] = $key;
null !== $position && $obj['position'] = $position;
null !== $possibleValues && $obj->possibleValues = $possibleValues;
null !== $possibleValues && $obj['possibleValues'] = $possibleValues;
null !== $queueBehaviour && $obj['queueBehaviour'] = $queueBehaviour;
null !== $type && $obj['type'] = $type;
null !== $valueRequired && $obj->valueRequired = $valueRequired;
null !== $webhooks && $obj->webhooks = $webhooks;
null !== $valueRequired && $obj['valueRequired'] = $valueRequired;
null !== $webhooks && $obj['webhooks'] = $webhooks;

return $obj;
}
Expand All @@ -194,7 +198,7 @@ public static function with(
public function withName(string $name): self
{
$obj = clone $this;
$obj->name = $name;
$obj['name'] = $name;

return $obj;
}
Expand All @@ -205,7 +209,7 @@ public function withName(string $name): self
public function withBuiltIn(?bool $builtIn): self
{
$obj = clone $this;
$obj->builtIn = $builtIn;
$obj['builtIn'] = $builtIn;

return $obj;
}
Expand All @@ -216,7 +220,7 @@ public function withBuiltIn(?bool $builtIn): self
public function withDescription(?string $description): self
{
$obj = clone $this;
$obj->description = $description;
$obj['description'] = $description;

return $obj;
}
Expand All @@ -229,7 +233,7 @@ public function withDescription(?string $description): self
public function withFilterInQueueIDs(array $filterInQueueIDs): self
{
$obj = clone $this;
$obj->filterInQueueIds = $filterInQueueIDs;
$obj['filterInQueueIds'] = $filterInQueueIDs;

return $obj;
}
Expand All @@ -240,7 +244,7 @@ public function withFilterInQueueIDs(array $filterInQueueIDs): self
public function withFreeText(bool $freeText): self
{
$obj = clone $this;
$obj->freeText = $freeText;
$obj['freeText'] = $freeText;

return $obj;
}
Expand All @@ -251,7 +255,7 @@ public function withFreeText(bool $freeText): self
public function withKey(?string $key): self
{
$obj = clone $this;
$obj->key = $key;
$obj['key'] = $key;

return $obj;
}
Expand All @@ -272,12 +276,12 @@ public function withPosition(Position|string $position): self
/**
* The possible values of the action. The user will be prompted to select one of these values when executing the action.
*
* @param list<PossibleValue> $possibleValues
* @param list<PossibleValue|array{value: string}> $possibleValues
*/
public function withPossibleValues(array $possibleValues): self
{
$obj = clone $this;
$obj->possibleValues = $possibleValues;
$obj['possibleValues'] = $possibleValues;

return $obj;
}
Expand Down Expand Up @@ -315,20 +319,22 @@ public function withType(Type|string|null $type): self
public function withValueRequired(bool $valueRequired): self
{
$obj = clone $this;
$obj->valueRequired = $valueRequired;
$obj['valueRequired'] = $valueRequired;

return $obj;
}

/**
* The action's webhooks.
*
* @param list<Webhook> $webhooks
* @param list<Webhook|array{
* name: string, url: string, id?: string|null, description?: string|null
* }> $webhooks
*/
public function withWebhooks(array $webhooks): self
{
$obj = clone $this;
$obj->webhooks = $webhooks;
$obj['webhooks'] = $webhooks;

return $obj;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/ActionCreateParams/PossibleValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function with(string $value): self
{
$obj = new self;

$obj->value = $value;
$obj['value'] = $value;

return $obj;
}
Expand All @@ -61,7 +61,7 @@ public static function with(string $value): self
public function withValue(string $value): self
{
$obj = clone $this;
$obj->value = $value;
$obj['value'] = $value;

return $obj;
}
Expand Down
16 changes: 8 additions & 8 deletions src/Actions/ActionCreateParams/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public static function with(
): self {
$obj = new self;

$obj->name = $name;
$obj->url = $url;
$obj['name'] = $name;
$obj['url'] = $url;

null !== $id && $obj->id = $id;
null !== $description && $obj->description = $description;
null !== $id && $obj['id'] = $id;
null !== $description && $obj['description'] = $description;

return $obj;
}
Expand All @@ -89,7 +89,7 @@ public static function with(
public function withName(string $name): self
{
$obj = clone $this;
$obj->name = $name;
$obj['name'] = $name;

return $obj;
}
Expand All @@ -100,7 +100,7 @@ public function withName(string $name): self
public function withURL(string $url): self
{
$obj = clone $this;
$obj->url = $url;
$obj['url'] = $url;

return $obj;
}
Expand All @@ -111,7 +111,7 @@ public function withURL(string $url): self
public function withID(string $id): self
{
$obj = clone $this;
$obj->id = $id;
$obj['id'] = $id;

return $obj;
}
Expand All @@ -122,7 +122,7 @@ public function withID(string $id): self
public function withDescription(?string $description): self
{
$obj = clone $this;
$obj->description = $description;
$obj['description'] = $description;

return $obj;
}
Expand Down
Loading