diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8f3e0a4..b4e9013 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.15.0" + ".": "0.16.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 3eb2b18..5b8da89 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/moderation-api-4750d2b76a21489b3dd82d7b7ad6d4cccc33b9827821c7fb5120cfdcc23b9088.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api/moderation-api-5d59d9b7fffd1ac6f329a62fdc42c97bfa7821168eeea0d686a2d48d90963c34.yml openapi_spec_hash: 61cd471624938b233f02dc17416946f2 -config_hash: 13d10207114afb65f7ac4e21f4c0e358 +config_hash: 9d144cc6c49d3fd53e5b4472c1e22165 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3556e54..ddfe93c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.16.0 (2026-05-08) + +Full Changelog: [v0.15.0...v0.16.0](https://github.com/moderation-api/sdk-php/compare/v0.15.0...v0.16.0) + +### Features + +* **api:** manual updates ([1367008](https://github.com/moderation-api/sdk-php/commit/1367008288383ae72f728c0bef059f04e1c8d9be)) + ## 0.15.0 (2026-05-08) Full Changelog: [v0.14.0...v0.15.0](https://github.com/moderation-api/sdk-php/compare/v0.14.0...v0.15.0) diff --git a/README.md b/README.md index 432bc79..f21273e 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.15.0" +composer require "moderation-api/sdk-php 0.16.0" ``` diff --git a/src/Queue/WebhookEvent.php b/src/Queue/WebhookEvent.php new file mode 100644 index 0000000..d9043b0 --- /dev/null +++ b/src/Queue/WebhookEvent.php @@ -0,0 +1,65 @@ +|array + */ + public static function variants(): array + { + return [ + 'author.blocked' => AuthorBlockedEvent::class, + 'author.unblocked' => AuthorUnblockedEvent::class, + 'author.suspended' => AuthorSuspendedEvent::class, + 'author.updated' => AuthorUpdatedEvent::class, + 'author.trust_level_changed' => AuthorTrustLevelChangedEvent::class, + 'author.action' => AuthorActionEvent::class, + 'queue_item.completed' => QueueItemCompletedEvent::class, + 'queue_item.action' => QueueItemActionEvent::class, + 'queue_item.rejected' => QueueItemRejectedEvent::class, + 'queue_item.allowed' => QueueItemAllowedEvent::class, + ]; + } +} diff --git a/src/Queue/WebhookEvent/AuthorActionEvent.php b/src/Queue/WebhookEvent/AuthorActionEvent.php new file mode 100644 index 0000000..b854508 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorActionEvent.php @@ -0,0 +1,151 @@ + */ + use SdkModel; + + /** @var 'v2' $apiVersion */ + #[Required('api_version')] + public string $apiVersion = 'v2'; + + /** + * The event type. + * + * @var 'author.action' $type + */ + #[Required] + public string $type = 'author.action'; + + /** + * Stable event ID. Use this to dedupe retries. + */ + #[Required] + public string $id; + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + #[Required] + public \DateTimeInterface $created; + + #[Required] + public Data $data; + + /** + * `new AuthorActionEvent()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AuthorActionEvent::with(id: ..., created: ..., data: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AuthorActionEvent)->withID(...)->withCreated(...)->withData(...) + * ``` + */ + 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. + * + * @param Data|DataShape $data + */ + public static function with( + string $id, + \DateTimeInterface $created, + Data|array $data + ): self { + $self = new self; + + $self['id'] = $id; + $self['created'] = $created; + $self['data'] = $data; + + return $self; + } + + /** + * Stable event ID. Use this to dedupe retries. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param 'v2' $apiVersion + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + public function withCreated(\DateTimeInterface $created): self + { + $self = clone $this; + $self['created'] = $created; + + return $self; + } + + /** + * @param Data|DataShape $data + */ + public function withData(Data|array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * The event type. + * + * @param 'author.action' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorActionEvent/Data.php b/src/Queue/WebhookEvent/AuthorActionEvent/Data.php new file mode 100644 index 0000000..c505793 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorActionEvent/Data.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + #[Required] + public Object_ $object; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with(object: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data)->withObject(...) + * ``` + */ + 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. + * + * @param Object_|ObjectShape $object + */ + public static function with(Object_|array $object): self + { + $self = new self; + + $self['object'] = $object; + + return $self; + } + + /** + * @param Object_|ObjectShape $object + */ + public function withObject(Object_|array $object): self + { + $self = clone $this; + $self['object'] = $object; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_.php b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_.php new file mode 100644 index 0000000..783b25d --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_.php @@ -0,0 +1,213 @@ + */ + use SdkModel; + + /** + * Moderation action ID. + */ + #[Required] + public string $id; + + /** + * The author the action was performed on. + */ + #[Required] + public Author $author; + + /** + * ISO 8601 timestamp of when the action was performed. + */ + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Customer-defined key identifying this action. + */ + #[Required] + public ?string $key; + + /** + * Display name of the action. + */ + #[Required] + public ?string $name; + + /** + * The value passed to the action when it ran. + */ + #[Required] + public ?string $value; + + /** + * The queue the item belongs to, if any. + */ + #[Optional] + public ?Queue $queue; + + /** + * `new Object_()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Object_::with( + * id: ..., author: ..., createdAt: ..., key: ..., name: ..., value: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Object_) + * ->withID(...) + * ->withAuthor(...) + * ->withCreatedAt(...) + * ->withKey(...) + * ->withName(...) + * ->withValue(...) + * ``` + */ + 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. + * + * @param Author|AuthorShape $author + * @param Queue|QueueShape|null $queue + */ + public static function with( + string $id, + Author|array $author, + \DateTimeInterface $createdAt, + ?string $key, + ?string $name, + ?string $value, + Queue|array|null $queue = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['author'] = $author; + $self['createdAt'] = $createdAt; + $self['key'] = $key; + $self['name'] = $name; + $self['value'] = $value; + + null !== $queue && $self['queue'] = $queue; + + return $self; + } + + /** + * Moderation action ID. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * The author the action was performed on. + * + * @param Author|AuthorShape $author + */ + public function withAuthor(Author|array $author): self + { + $self = clone $this; + $self['author'] = $author; + + return $self; + } + + /** + * ISO 8601 timestamp of when the action was performed. + */ + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Customer-defined key identifying this action. + */ + public function withKey(?string $key): self + { + $self = clone $this; + $self['key'] = $key; + + return $self; + } + + /** + * Display name of the action. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * The value passed to the action when it ran. + */ + public function withValue(?string $value): self + { + $self = clone $this; + $self['value'] = $value; + + return $self; + } + + /** + * The queue the item belongs to, if any. + * + * @param Queue|QueueShape $queue + */ + public function withQueue(Queue|array $queue): self + { + $self = clone $this; + $self['queue'] = $queue; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author.php b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author.php new file mode 100644 index 0000000..23294eb --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author.php @@ -0,0 +1,418 @@ +, + * trustLevel: TrustLevel|TrustLevelShape, + * company?: string|null, + * email?: string|null, + * externalID?: string|null, + * externalLink?: string|null, + * lastIncident?: float|null, + * name?: string|null, + * profilePicture?: string|null, + * } + */ +final class Author implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Author ID in Moderation API. + */ + #[Required] + public string $id; + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + */ + #[Required] + public ?Block $block; + + /** + * Timestamp when author first appeared. + */ + #[Required('first_seen')] + public float $firstSeen; + + /** + * Timestamp of last activity. + */ + #[Required('last_seen')] + public float $lastSeen; + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + */ + #[Required] + public Metadata $metadata; + + #[Required] + public Metrics $metrics; + + /** + * Risk assessment details, if available. + */ + #[Required('risk_evaluation')] + public ?RiskEvaluation $riskEvaluation; + + /** + * Current author status. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + #[Required('trust_level')] + public TrustLevel $trustLevel; + + /** + * The author's company or organization. + */ + #[Optional(nullable: true)] + public ?string $company; + + /** + * Author email address. + */ + #[Optional(nullable: true)] + public ?string $email; + + /** + * The author's ID from your system. + */ + #[Optional('external_id', nullable: true)] + public ?string $externalID; + + /** + * URL of the author's external profile. + */ + #[Optional('external_link', nullable: true)] + public ?string $externalLink; + + /** + * Timestamp of last incident. + */ + #[Optional('last_incident', nullable: true)] + public ?float $lastIncident; + + /** + * Author name or identifier. + */ + #[Optional(nullable: true)] + public ?string $name; + + /** + * URL of the author's profile picture. + */ + #[Optional('profile_picture', nullable: true)] + public ?string $profilePicture; + + /** + * `new Author()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Author::with( + * id: ..., + * block: ..., + * firstSeen: ..., + * lastSeen: ..., + * metadata: ..., + * metrics: ..., + * riskEvaluation: ..., + * status: ..., + * trustLevel: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Author) + * ->withID(...) + * ->withBlock(...) + * ->withFirstSeen(...) + * ->withLastSeen(...) + * ->withMetadata(...) + * ->withMetrics(...) + * ->withRiskEvaluation(...) + * ->withStatus(...) + * ->withTrustLevel(...) + * ``` + */ + 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. + * + * @param Block|BlockShape|null $block + * @param Metadata|MetadataShape $metadata + * @param Metrics|MetricsShape $metrics + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + * @param Status|value-of $status + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public static function with( + string $id, + Block|array|null $block, + float $firstSeen, + float $lastSeen, + Metadata|array $metadata, + Metrics|array $metrics, + RiskEvaluation|array|null $riskEvaluation, + Status|string $status, + TrustLevel|array $trustLevel, + ?string $company = null, + ?string $email = null, + ?string $externalID = null, + ?string $externalLink = null, + ?float $lastIncident = null, + ?string $name = null, + ?string $profilePicture = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['block'] = $block; + $self['firstSeen'] = $firstSeen; + $self['lastSeen'] = $lastSeen; + $self['metadata'] = $metadata; + $self['metrics'] = $metrics; + $self['riskEvaluation'] = $riskEvaluation; + $self['status'] = $status; + $self['trustLevel'] = $trustLevel; + + null !== $company && $self['company'] = $company; + null !== $email && $self['email'] = $email; + null !== $externalID && $self['externalID'] = $externalID; + null !== $externalLink && $self['externalLink'] = $externalLink; + null !== $lastIncident && $self['lastIncident'] = $lastIncident; + null !== $name && $self['name'] = $name; + null !== $profilePicture && $self['profilePicture'] = $profilePicture; + + return $self; + } + + /** + * Author ID in Moderation API. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + * + * @param Block|BlockShape|null $block + */ + public function withBlock(Block|array|null $block): self + { + $self = clone $this; + $self['block'] = $block; + + return $self; + } + + /** + * Timestamp when author first appeared. + */ + public function withFirstSeen(float $firstSeen): self + { + $self = clone $this; + $self['firstSeen'] = $firstSeen; + + return $self; + } + + /** + * Timestamp of last activity. + */ + public function withLastSeen(float $lastSeen): self + { + $self = clone $this; + $self['lastSeen'] = $lastSeen; + + return $self; + } + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * @param Metrics|MetricsShape $metrics + */ + public function withMetrics(Metrics|array $metrics): self + { + $self = clone $this; + $self['metrics'] = $metrics; + + return $self; + } + + /** + * Risk assessment details, if available. + * + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + */ + public function withRiskEvaluation( + RiskEvaluation|array|null $riskEvaluation + ): self { + $self = clone $this; + $self['riskEvaluation'] = $riskEvaluation; + + return $self; + } + + /** + * Current author status. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public function withTrustLevel(TrustLevel|array $trustLevel): self + { + $self = clone $this; + $self['trustLevel'] = $trustLevel; + + return $self; + } + + /** + * The author's company or organization. + */ + public function withCompany(?string $company): self + { + $self = clone $this; + $self['company'] = $company; + + return $self; + } + + /** + * Author email address. + */ + public function withEmail(?string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * The author's ID from your system. + */ + public function withExternalID(?string $externalID): self + { + $self = clone $this; + $self['externalID'] = $externalID; + + return $self; + } + + /** + * URL of the author's external profile. + */ + public function withExternalLink(?string $externalLink): self + { + $self = clone $this; + $self['externalLink'] = $externalLink; + + return $self; + } + + /** + * Timestamp of last incident. + */ + public function withLastIncident(?float $lastIncident): self + { + $self = clone $this; + $self['lastIncident'] = $lastIncident; + + return $self; + } + + /** + * Author name or identifier. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * URL of the author's profile picture. + */ + public function withProfilePicture(?string $profilePicture): self + { + $self = clone $this; + $self['profilePicture'] = $profilePicture; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Block.php b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Block.php new file mode 100644 index 0000000..8ceb533 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Block.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + /** + * The moderators reason why the author was blocked or suspended. + */ + #[Optional(nullable: true)] + public ?string $reason; + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + #[Optional(nullable: true)] + public ?float $until; + + 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( + ?string $reason = null, + ?float $until = null + ): self { + $self = new self; + + null !== $reason && $self['reason'] = $reason; + null !== $until && $self['until'] = $until; + + return $self; + } + + /** + * The moderators reason why the author was blocked or suspended. + */ + public function withReason(?string $reason): self + { + $self = clone $this; + $self['reason'] = $reason; + + return $self; + } + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + public function withUntil(?float $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Metadata.php b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Metadata.php new file mode 100644 index 0000000..ef41436 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Metadata.php @@ -0,0 +1,119 @@ + */ + use SdkModel; + + /** + * Whether the author's email is verified. + */ + #[Optional('email_verified', nullable: true)] + public ?bool $emailVerified; + + /** + * Whether the author's identity is verified. + */ + #[Optional('identity_verified', nullable: true)] + public ?bool $identityVerified; + + /** + * Whether the author is a paying customer. + */ + #[Optional('is_paying_customer', nullable: true)] + public ?bool $isPayingCustomer; + + /** + * Whether the author's phone number is verified. + */ + #[Optional('phone_verified', nullable: true)] + public ?bool $phoneVerified; + + 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 $emailVerified = null, + ?bool $identityVerified = null, + ?bool $isPayingCustomer = null, + ?bool $phoneVerified = null, + ): self { + $self = new self; + + null !== $emailVerified && $self['emailVerified'] = $emailVerified; + null !== $identityVerified && $self['identityVerified'] = $identityVerified; + null !== $isPayingCustomer && $self['isPayingCustomer'] = $isPayingCustomer; + null !== $phoneVerified && $self['phoneVerified'] = $phoneVerified; + + return $self; + } + + /** + * Whether the author's email is verified. + */ + public function withEmailVerified(?bool $emailVerified): self + { + $self = clone $this; + $self['emailVerified'] = $emailVerified; + + return $self; + } + + /** + * Whether the author's identity is verified. + */ + public function withIdentityVerified(?bool $identityVerified): self + { + $self = clone $this; + $self['identityVerified'] = $identityVerified; + + return $self; + } + + /** + * Whether the author is a paying customer. + */ + public function withIsPayingCustomer(?bool $isPayingCustomer): self + { + $self = clone $this; + $self['isPayingCustomer'] = $isPayingCustomer; + + return $self; + } + + /** + * Whether the author's phone number is verified. + */ + public function withPhoneVerified(?bool $phoneVerified): self + { + $self = clone $this; + $self['phoneVerified'] = $phoneVerified; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Metrics.php b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Metrics.php new file mode 100644 index 0000000..890c551 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Metrics.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Number of flagged content pieces. + */ + #[Required('flagged_content')] + public float $flaggedContent; + + /** + * Total pieces of content. + */ + #[Required('total_content')] + public float $totalContent; + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + #[Optional('average_sentiment', nullable: true)] + public ?float $averageSentiment; + + /** + * `new Metrics()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metrics::with(flaggedContent: ..., totalContent: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metrics)->withFlaggedContent(...)->withTotalContent(...) + * ``` + */ + 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( + float $flaggedContent, + float $totalContent, + ?float $averageSentiment = null + ): self { + $self = new self; + + $self['flaggedContent'] = $flaggedContent; + $self['totalContent'] = $totalContent; + + null !== $averageSentiment && $self['averageSentiment'] = $averageSentiment; + + return $self; + } + + /** + * Number of flagged content pieces. + */ + public function withFlaggedContent(float $flaggedContent): self + { + $self = clone $this; + $self['flaggedContent'] = $flaggedContent; + + return $self; + } + + /** + * Total pieces of content. + */ + public function withTotalContent(float $totalContent): self + { + $self = clone $this; + $self['totalContent'] = $totalContent; + + return $self; + } + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + public function withAverageSentiment(?float $averageSentiment): self + { + $self = clone $this; + $self['averageSentiment'] = $averageSentiment; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/RiskEvaluation.php b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/RiskEvaluation.php new file mode 100644 index 0000000..3549a98 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/RiskEvaluation.php @@ -0,0 +1,56 @@ + */ + use SdkModel; + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + #[Optional('risk_level', nullable: true)] + public ?float $riskLevel; + + 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(?float $riskLevel = null): self + { + $self = new self; + + null !== $riskLevel && $self['riskLevel'] = $riskLevel; + + return $self; + } + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + public function withRiskLevel(?float $riskLevel): self + { + $self = clone $this; + $self['riskLevel'] = $riskLevel; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Status.php b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Status.php new file mode 100644 index 0000000..c25f06a --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Author/Status.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + #[Required] + public float $level; + + /** + * True if the trust level was set manually by a moderator. + */ + #[Required] + public bool $manual; + + /** + * `new TrustLevel()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * TrustLevel::with(level: ..., manual: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new TrustLevel)->withLevel(...)->withManual(...) + * ``` + */ + 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(float $level, bool $manual): self + { + $self = new self; + + $self['level'] = $level; + $self['manual'] = $manual; + + return $self; + } + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + public function withLevel(float $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * True if the trust level was set manually by a moderator. + */ + public function withManual(bool $manual): self + { + $self = clone $this; + $self['manual'] = $manual; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Queue.php b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Queue.php new file mode 100644 index 0000000..3988b5d --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorActionEvent/Data/Object_/Queue.php @@ -0,0 +1,64 @@ + */ + use SdkModel; + + #[Required] + public string $id; + + /** + * `new Queue()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Queue::with(id: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Queue)->withID(...) + * ``` + */ + 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(string $id): self + { + $self = new self; + + $self['id'] = $id; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorBlockedEvent.php b/src/Queue/WebhookEvent/AuthorBlockedEvent.php new file mode 100644 index 0000000..22b8f2a --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorBlockedEvent.php @@ -0,0 +1,151 @@ + */ + use SdkModel; + + /** @var 'v2' $apiVersion */ + #[Required('api_version')] + public string $apiVersion = 'v2'; + + /** + * The event type. + * + * @var 'author.blocked' $type + */ + #[Required] + public string $type = 'author.blocked'; + + /** + * Stable event ID. Use this to dedupe retries. + */ + #[Required] + public string $id; + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + #[Required] + public \DateTimeInterface $created; + + #[Required] + public Data $data; + + /** + * `new AuthorBlockedEvent()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AuthorBlockedEvent::with(id: ..., created: ..., data: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AuthorBlockedEvent)->withID(...)->withCreated(...)->withData(...) + * ``` + */ + 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. + * + * @param Data|DataShape $data + */ + public static function with( + string $id, + \DateTimeInterface $created, + Data|array $data + ): self { + $self = new self; + + $self['id'] = $id; + $self['created'] = $created; + $self['data'] = $data; + + return $self; + } + + /** + * Stable event ID. Use this to dedupe retries. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param 'v2' $apiVersion + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + public function withCreated(\DateTimeInterface $created): self + { + $self = clone $this; + $self['created'] = $created; + + return $self; + } + + /** + * @param Data|DataShape $data + */ + public function withData(Data|array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * The event type. + * + * @param 'author.blocked' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorBlockedEvent/Data.php b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data.php new file mode 100644 index 0000000..5008ec3 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + #[Required] + public Object_ $object; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with(object: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data)->withObject(...) + * ``` + */ + 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. + * + * @param Object_|ObjectShape $object + */ + public static function with(Object_|array $object): self + { + $self = new self; + + $self['object'] = $object; + + return $self; + } + + /** + * @param Object_|ObjectShape $object + */ + public function withObject(Object_|array $object): self + { + $self = clone $this; + $self['object'] = $object; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_.php b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_.php new file mode 100644 index 0000000..25fcece --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_.php @@ -0,0 +1,213 @@ + */ + use SdkModel; + + /** + * Moderation action ID. + */ + #[Required] + public string $id; + + /** + * The author the action was performed on. + */ + #[Required] + public Author $author; + + /** + * ISO 8601 timestamp of when the action was performed. + */ + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Customer-defined key identifying this action. + */ + #[Required] + public ?string $key; + + /** + * Display name of the action. + */ + #[Required] + public ?string $name; + + /** + * The value passed to the action when it ran. + */ + #[Required] + public ?string $value; + + /** + * The queue the item belongs to, if any. + */ + #[Optional] + public ?Queue $queue; + + /** + * `new Object_()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Object_::with( + * id: ..., author: ..., createdAt: ..., key: ..., name: ..., value: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Object_) + * ->withID(...) + * ->withAuthor(...) + * ->withCreatedAt(...) + * ->withKey(...) + * ->withName(...) + * ->withValue(...) + * ``` + */ + 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. + * + * @param Author|AuthorShape $author + * @param Queue|QueueShape|null $queue + */ + public static function with( + string $id, + Author|array $author, + \DateTimeInterface $createdAt, + ?string $key, + ?string $name, + ?string $value, + Queue|array|null $queue = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['author'] = $author; + $self['createdAt'] = $createdAt; + $self['key'] = $key; + $self['name'] = $name; + $self['value'] = $value; + + null !== $queue && $self['queue'] = $queue; + + return $self; + } + + /** + * Moderation action ID. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * The author the action was performed on. + * + * @param Author|AuthorShape $author + */ + public function withAuthor(Author|array $author): self + { + $self = clone $this; + $self['author'] = $author; + + return $self; + } + + /** + * ISO 8601 timestamp of when the action was performed. + */ + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Customer-defined key identifying this action. + */ + public function withKey(?string $key): self + { + $self = clone $this; + $self['key'] = $key; + + return $self; + } + + /** + * Display name of the action. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * The value passed to the action when it ran. + */ + public function withValue(?string $value): self + { + $self = clone $this; + $self['value'] = $value; + + return $self; + } + + /** + * The queue the item belongs to, if any. + * + * @param Queue|QueueShape $queue + */ + public function withQueue(Queue|array $queue): self + { + $self = clone $this; + $self['queue'] = $queue; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author.php b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author.php new file mode 100644 index 0000000..68dd7b2 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author.php @@ -0,0 +1,418 @@ +, + * trustLevel: TrustLevel|TrustLevelShape, + * company?: string|null, + * email?: string|null, + * externalID?: string|null, + * externalLink?: string|null, + * lastIncident?: float|null, + * name?: string|null, + * profilePicture?: string|null, + * } + */ +final class Author implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Author ID in Moderation API. + */ + #[Required] + public string $id; + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + */ + #[Required] + public ?Block $block; + + /** + * Timestamp when author first appeared. + */ + #[Required('first_seen')] + public float $firstSeen; + + /** + * Timestamp of last activity. + */ + #[Required('last_seen')] + public float $lastSeen; + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + */ + #[Required] + public Metadata $metadata; + + #[Required] + public Metrics $metrics; + + /** + * Risk assessment details, if available. + */ + #[Required('risk_evaluation')] + public ?RiskEvaluation $riskEvaluation; + + /** + * Current author status. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + #[Required('trust_level')] + public TrustLevel $trustLevel; + + /** + * The author's company or organization. + */ + #[Optional(nullable: true)] + public ?string $company; + + /** + * Author email address. + */ + #[Optional(nullable: true)] + public ?string $email; + + /** + * The author's ID from your system. + */ + #[Optional('external_id', nullable: true)] + public ?string $externalID; + + /** + * URL of the author's external profile. + */ + #[Optional('external_link', nullable: true)] + public ?string $externalLink; + + /** + * Timestamp of last incident. + */ + #[Optional('last_incident', nullable: true)] + public ?float $lastIncident; + + /** + * Author name or identifier. + */ + #[Optional(nullable: true)] + public ?string $name; + + /** + * URL of the author's profile picture. + */ + #[Optional('profile_picture', nullable: true)] + public ?string $profilePicture; + + /** + * `new Author()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Author::with( + * id: ..., + * block: ..., + * firstSeen: ..., + * lastSeen: ..., + * metadata: ..., + * metrics: ..., + * riskEvaluation: ..., + * status: ..., + * trustLevel: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Author) + * ->withID(...) + * ->withBlock(...) + * ->withFirstSeen(...) + * ->withLastSeen(...) + * ->withMetadata(...) + * ->withMetrics(...) + * ->withRiskEvaluation(...) + * ->withStatus(...) + * ->withTrustLevel(...) + * ``` + */ + 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. + * + * @param Block|BlockShape|null $block + * @param Metadata|MetadataShape $metadata + * @param Metrics|MetricsShape $metrics + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + * @param Status|value-of $status + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public static function with( + string $id, + Block|array|null $block, + float $firstSeen, + float $lastSeen, + Metadata|array $metadata, + Metrics|array $metrics, + RiskEvaluation|array|null $riskEvaluation, + Status|string $status, + TrustLevel|array $trustLevel, + ?string $company = null, + ?string $email = null, + ?string $externalID = null, + ?string $externalLink = null, + ?float $lastIncident = null, + ?string $name = null, + ?string $profilePicture = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['block'] = $block; + $self['firstSeen'] = $firstSeen; + $self['lastSeen'] = $lastSeen; + $self['metadata'] = $metadata; + $self['metrics'] = $metrics; + $self['riskEvaluation'] = $riskEvaluation; + $self['status'] = $status; + $self['trustLevel'] = $trustLevel; + + null !== $company && $self['company'] = $company; + null !== $email && $self['email'] = $email; + null !== $externalID && $self['externalID'] = $externalID; + null !== $externalLink && $self['externalLink'] = $externalLink; + null !== $lastIncident && $self['lastIncident'] = $lastIncident; + null !== $name && $self['name'] = $name; + null !== $profilePicture && $self['profilePicture'] = $profilePicture; + + return $self; + } + + /** + * Author ID in Moderation API. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + * + * @param Block|BlockShape|null $block + */ + public function withBlock(Block|array|null $block): self + { + $self = clone $this; + $self['block'] = $block; + + return $self; + } + + /** + * Timestamp when author first appeared. + */ + public function withFirstSeen(float $firstSeen): self + { + $self = clone $this; + $self['firstSeen'] = $firstSeen; + + return $self; + } + + /** + * Timestamp of last activity. + */ + public function withLastSeen(float $lastSeen): self + { + $self = clone $this; + $self['lastSeen'] = $lastSeen; + + return $self; + } + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * @param Metrics|MetricsShape $metrics + */ + public function withMetrics(Metrics|array $metrics): self + { + $self = clone $this; + $self['metrics'] = $metrics; + + return $self; + } + + /** + * Risk assessment details, if available. + * + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + */ + public function withRiskEvaluation( + RiskEvaluation|array|null $riskEvaluation + ): self { + $self = clone $this; + $self['riskEvaluation'] = $riskEvaluation; + + return $self; + } + + /** + * Current author status. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public function withTrustLevel(TrustLevel|array $trustLevel): self + { + $self = clone $this; + $self['trustLevel'] = $trustLevel; + + return $self; + } + + /** + * The author's company or organization. + */ + public function withCompany(?string $company): self + { + $self = clone $this; + $self['company'] = $company; + + return $self; + } + + /** + * Author email address. + */ + public function withEmail(?string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * The author's ID from your system. + */ + public function withExternalID(?string $externalID): self + { + $self = clone $this; + $self['externalID'] = $externalID; + + return $self; + } + + /** + * URL of the author's external profile. + */ + public function withExternalLink(?string $externalLink): self + { + $self = clone $this; + $self['externalLink'] = $externalLink; + + return $self; + } + + /** + * Timestamp of last incident. + */ + public function withLastIncident(?float $lastIncident): self + { + $self = clone $this; + $self['lastIncident'] = $lastIncident; + + return $self; + } + + /** + * Author name or identifier. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * URL of the author's profile picture. + */ + public function withProfilePicture(?string $profilePicture): self + { + $self = clone $this; + $self['profilePicture'] = $profilePicture; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Block.php b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Block.php new file mode 100644 index 0000000..3224903 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Block.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + /** + * The moderators reason why the author was blocked or suspended. + */ + #[Optional(nullable: true)] + public ?string $reason; + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + #[Optional(nullable: true)] + public ?float $until; + + 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( + ?string $reason = null, + ?float $until = null + ): self { + $self = new self; + + null !== $reason && $self['reason'] = $reason; + null !== $until && $self['until'] = $until; + + return $self; + } + + /** + * The moderators reason why the author was blocked or suspended. + */ + public function withReason(?string $reason): self + { + $self = clone $this; + $self['reason'] = $reason; + + return $self; + } + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + public function withUntil(?float $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Metadata.php b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Metadata.php new file mode 100644 index 0000000..6acde6a --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Metadata.php @@ -0,0 +1,119 @@ + */ + use SdkModel; + + /** + * Whether the author's email is verified. + */ + #[Optional('email_verified', nullable: true)] + public ?bool $emailVerified; + + /** + * Whether the author's identity is verified. + */ + #[Optional('identity_verified', nullable: true)] + public ?bool $identityVerified; + + /** + * Whether the author is a paying customer. + */ + #[Optional('is_paying_customer', nullable: true)] + public ?bool $isPayingCustomer; + + /** + * Whether the author's phone number is verified. + */ + #[Optional('phone_verified', nullable: true)] + public ?bool $phoneVerified; + + 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 $emailVerified = null, + ?bool $identityVerified = null, + ?bool $isPayingCustomer = null, + ?bool $phoneVerified = null, + ): self { + $self = new self; + + null !== $emailVerified && $self['emailVerified'] = $emailVerified; + null !== $identityVerified && $self['identityVerified'] = $identityVerified; + null !== $isPayingCustomer && $self['isPayingCustomer'] = $isPayingCustomer; + null !== $phoneVerified && $self['phoneVerified'] = $phoneVerified; + + return $self; + } + + /** + * Whether the author's email is verified. + */ + public function withEmailVerified(?bool $emailVerified): self + { + $self = clone $this; + $self['emailVerified'] = $emailVerified; + + return $self; + } + + /** + * Whether the author's identity is verified. + */ + public function withIdentityVerified(?bool $identityVerified): self + { + $self = clone $this; + $self['identityVerified'] = $identityVerified; + + return $self; + } + + /** + * Whether the author is a paying customer. + */ + public function withIsPayingCustomer(?bool $isPayingCustomer): self + { + $self = clone $this; + $self['isPayingCustomer'] = $isPayingCustomer; + + return $self; + } + + /** + * Whether the author's phone number is verified. + */ + public function withPhoneVerified(?bool $phoneVerified): self + { + $self = clone $this; + $self['phoneVerified'] = $phoneVerified; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Metrics.php b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Metrics.php new file mode 100644 index 0000000..184f22b --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Metrics.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Number of flagged content pieces. + */ + #[Required('flagged_content')] + public float $flaggedContent; + + /** + * Total pieces of content. + */ + #[Required('total_content')] + public float $totalContent; + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + #[Optional('average_sentiment', nullable: true)] + public ?float $averageSentiment; + + /** + * `new Metrics()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metrics::with(flaggedContent: ..., totalContent: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metrics)->withFlaggedContent(...)->withTotalContent(...) + * ``` + */ + 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( + float $flaggedContent, + float $totalContent, + ?float $averageSentiment = null + ): self { + $self = new self; + + $self['flaggedContent'] = $flaggedContent; + $self['totalContent'] = $totalContent; + + null !== $averageSentiment && $self['averageSentiment'] = $averageSentiment; + + return $self; + } + + /** + * Number of flagged content pieces. + */ + public function withFlaggedContent(float $flaggedContent): self + { + $self = clone $this; + $self['flaggedContent'] = $flaggedContent; + + return $self; + } + + /** + * Total pieces of content. + */ + public function withTotalContent(float $totalContent): self + { + $self = clone $this; + $self['totalContent'] = $totalContent; + + return $self; + } + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + public function withAverageSentiment(?float $averageSentiment): self + { + $self = clone $this; + $self['averageSentiment'] = $averageSentiment; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/RiskEvaluation.php b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/RiskEvaluation.php new file mode 100644 index 0000000..6a974bb --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/RiskEvaluation.php @@ -0,0 +1,56 @@ + */ + use SdkModel; + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + #[Optional('risk_level', nullable: true)] + public ?float $riskLevel; + + 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(?float $riskLevel = null): self + { + $self = new self; + + null !== $riskLevel && $self['riskLevel'] = $riskLevel; + + return $self; + } + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + public function withRiskLevel(?float $riskLevel): self + { + $self = clone $this; + $self['riskLevel'] = $riskLevel; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Status.php b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Status.php new file mode 100644 index 0000000..c190a56 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Author/Status.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + #[Required] + public float $level; + + /** + * True if the trust level was set manually by a moderator. + */ + #[Required] + public bool $manual; + + /** + * `new TrustLevel()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * TrustLevel::with(level: ..., manual: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new TrustLevel)->withLevel(...)->withManual(...) + * ``` + */ + 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(float $level, bool $manual): self + { + $self = new self; + + $self['level'] = $level; + $self['manual'] = $manual; + + return $self; + } + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + public function withLevel(float $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * True if the trust level was set manually by a moderator. + */ + public function withManual(bool $manual): self + { + $self = clone $this; + $self['manual'] = $manual; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Queue.php b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Queue.php new file mode 100644 index 0000000..40fa80b --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorBlockedEvent/Data/Object_/Queue.php @@ -0,0 +1,64 @@ + */ + use SdkModel; + + #[Required] + public string $id; + + /** + * `new Queue()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Queue::with(id: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Queue)->withID(...) + * ``` + */ + 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(string $id): self + { + $self = new self; + + $self['id'] = $id; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorSuspendedEvent.php b/src/Queue/WebhookEvent/AuthorSuspendedEvent.php new file mode 100644 index 0000000..74e8c4e --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorSuspendedEvent.php @@ -0,0 +1,151 @@ + */ + use SdkModel; + + /** @var 'v2' $apiVersion */ + #[Required('api_version')] + public string $apiVersion = 'v2'; + + /** + * The event type. + * + * @var 'author.suspended' $type + */ + #[Required] + public string $type = 'author.suspended'; + + /** + * Stable event ID. Use this to dedupe retries. + */ + #[Required] + public string $id; + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + #[Required] + public \DateTimeInterface $created; + + #[Required] + public Data $data; + + /** + * `new AuthorSuspendedEvent()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AuthorSuspendedEvent::with(id: ..., created: ..., data: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AuthorSuspendedEvent)->withID(...)->withCreated(...)->withData(...) + * ``` + */ + 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. + * + * @param Data|DataShape $data + */ + public static function with( + string $id, + \DateTimeInterface $created, + Data|array $data + ): self { + $self = new self; + + $self['id'] = $id; + $self['created'] = $created; + $self['data'] = $data; + + return $self; + } + + /** + * Stable event ID. Use this to dedupe retries. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param 'v2' $apiVersion + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + public function withCreated(\DateTimeInterface $created): self + { + $self = clone $this; + $self['created'] = $created; + + return $self; + } + + /** + * @param Data|DataShape $data + */ + public function withData(Data|array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * The event type. + * + * @param 'author.suspended' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data.php b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data.php new file mode 100644 index 0000000..521e4ab --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + #[Required] + public Object_ $object; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with(object: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data)->withObject(...) + * ``` + */ + 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. + * + * @param Object_|ObjectShape $object + */ + public static function with(Object_|array $object): self + { + $self = new self; + + $self['object'] = $object; + + return $self; + } + + /** + * @param Object_|ObjectShape $object + */ + public function withObject(Object_|array $object): self + { + $self = clone $this; + $self['object'] = $object; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_.php b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_.php new file mode 100644 index 0000000..1d4ecbc --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_.php @@ -0,0 +1,213 @@ + */ + use SdkModel; + + /** + * Moderation action ID. + */ + #[Required] + public string $id; + + /** + * The author the action was performed on. + */ + #[Required] + public Author $author; + + /** + * ISO 8601 timestamp of when the action was performed. + */ + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Customer-defined key identifying this action. + */ + #[Required] + public ?string $key; + + /** + * Display name of the action. + */ + #[Required] + public ?string $name; + + /** + * The value passed to the action when it ran. + */ + #[Required] + public ?string $value; + + /** + * The queue the item belongs to, if any. + */ + #[Optional] + public ?Queue $queue; + + /** + * `new Object_()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Object_::with( + * id: ..., author: ..., createdAt: ..., key: ..., name: ..., value: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Object_) + * ->withID(...) + * ->withAuthor(...) + * ->withCreatedAt(...) + * ->withKey(...) + * ->withName(...) + * ->withValue(...) + * ``` + */ + 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. + * + * @param Author|AuthorShape $author + * @param Queue|QueueShape|null $queue + */ + public static function with( + string $id, + Author|array $author, + \DateTimeInterface $createdAt, + ?string $key, + ?string $name, + ?string $value, + Queue|array|null $queue = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['author'] = $author; + $self['createdAt'] = $createdAt; + $self['key'] = $key; + $self['name'] = $name; + $self['value'] = $value; + + null !== $queue && $self['queue'] = $queue; + + return $self; + } + + /** + * Moderation action ID. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * The author the action was performed on. + * + * @param Author|AuthorShape $author + */ + public function withAuthor(Author|array $author): self + { + $self = clone $this; + $self['author'] = $author; + + return $self; + } + + /** + * ISO 8601 timestamp of when the action was performed. + */ + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Customer-defined key identifying this action. + */ + public function withKey(?string $key): self + { + $self = clone $this; + $self['key'] = $key; + + return $self; + } + + /** + * Display name of the action. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * The value passed to the action when it ran. + */ + public function withValue(?string $value): self + { + $self = clone $this; + $self['value'] = $value; + + return $self; + } + + /** + * The queue the item belongs to, if any. + * + * @param Queue|QueueShape $queue + */ + public function withQueue(Queue|array $queue): self + { + $self = clone $this; + $self['queue'] = $queue; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author.php b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author.php new file mode 100644 index 0000000..4e66f11 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author.php @@ -0,0 +1,418 @@ +, + * trustLevel: TrustLevel|TrustLevelShape, + * company?: string|null, + * email?: string|null, + * externalID?: string|null, + * externalLink?: string|null, + * lastIncident?: float|null, + * name?: string|null, + * profilePicture?: string|null, + * } + */ +final class Author implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Author ID in Moderation API. + */ + #[Required] + public string $id; + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + */ + #[Required] + public ?Block $block; + + /** + * Timestamp when author first appeared. + */ + #[Required('first_seen')] + public float $firstSeen; + + /** + * Timestamp of last activity. + */ + #[Required('last_seen')] + public float $lastSeen; + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + */ + #[Required] + public Metadata $metadata; + + #[Required] + public Metrics $metrics; + + /** + * Risk assessment details, if available. + */ + #[Required('risk_evaluation')] + public ?RiskEvaluation $riskEvaluation; + + /** + * Current author status. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + #[Required('trust_level')] + public TrustLevel $trustLevel; + + /** + * The author's company or organization. + */ + #[Optional(nullable: true)] + public ?string $company; + + /** + * Author email address. + */ + #[Optional(nullable: true)] + public ?string $email; + + /** + * The author's ID from your system. + */ + #[Optional('external_id', nullable: true)] + public ?string $externalID; + + /** + * URL of the author's external profile. + */ + #[Optional('external_link', nullable: true)] + public ?string $externalLink; + + /** + * Timestamp of last incident. + */ + #[Optional('last_incident', nullable: true)] + public ?float $lastIncident; + + /** + * Author name or identifier. + */ + #[Optional(nullable: true)] + public ?string $name; + + /** + * URL of the author's profile picture. + */ + #[Optional('profile_picture', nullable: true)] + public ?string $profilePicture; + + /** + * `new Author()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Author::with( + * id: ..., + * block: ..., + * firstSeen: ..., + * lastSeen: ..., + * metadata: ..., + * metrics: ..., + * riskEvaluation: ..., + * status: ..., + * trustLevel: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Author) + * ->withID(...) + * ->withBlock(...) + * ->withFirstSeen(...) + * ->withLastSeen(...) + * ->withMetadata(...) + * ->withMetrics(...) + * ->withRiskEvaluation(...) + * ->withStatus(...) + * ->withTrustLevel(...) + * ``` + */ + 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. + * + * @param Block|BlockShape|null $block + * @param Metadata|MetadataShape $metadata + * @param Metrics|MetricsShape $metrics + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + * @param Status|value-of $status + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public static function with( + string $id, + Block|array|null $block, + float $firstSeen, + float $lastSeen, + Metadata|array $metadata, + Metrics|array $metrics, + RiskEvaluation|array|null $riskEvaluation, + Status|string $status, + TrustLevel|array $trustLevel, + ?string $company = null, + ?string $email = null, + ?string $externalID = null, + ?string $externalLink = null, + ?float $lastIncident = null, + ?string $name = null, + ?string $profilePicture = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['block'] = $block; + $self['firstSeen'] = $firstSeen; + $self['lastSeen'] = $lastSeen; + $self['metadata'] = $metadata; + $self['metrics'] = $metrics; + $self['riskEvaluation'] = $riskEvaluation; + $self['status'] = $status; + $self['trustLevel'] = $trustLevel; + + null !== $company && $self['company'] = $company; + null !== $email && $self['email'] = $email; + null !== $externalID && $self['externalID'] = $externalID; + null !== $externalLink && $self['externalLink'] = $externalLink; + null !== $lastIncident && $self['lastIncident'] = $lastIncident; + null !== $name && $self['name'] = $name; + null !== $profilePicture && $self['profilePicture'] = $profilePicture; + + return $self; + } + + /** + * Author ID in Moderation API. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + * + * @param Block|BlockShape|null $block + */ + public function withBlock(Block|array|null $block): self + { + $self = clone $this; + $self['block'] = $block; + + return $self; + } + + /** + * Timestamp when author first appeared. + */ + public function withFirstSeen(float $firstSeen): self + { + $self = clone $this; + $self['firstSeen'] = $firstSeen; + + return $self; + } + + /** + * Timestamp of last activity. + */ + public function withLastSeen(float $lastSeen): self + { + $self = clone $this; + $self['lastSeen'] = $lastSeen; + + return $self; + } + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * @param Metrics|MetricsShape $metrics + */ + public function withMetrics(Metrics|array $metrics): self + { + $self = clone $this; + $self['metrics'] = $metrics; + + return $self; + } + + /** + * Risk assessment details, if available. + * + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + */ + public function withRiskEvaluation( + RiskEvaluation|array|null $riskEvaluation + ): self { + $self = clone $this; + $self['riskEvaluation'] = $riskEvaluation; + + return $self; + } + + /** + * Current author status. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public function withTrustLevel(TrustLevel|array $trustLevel): self + { + $self = clone $this; + $self['trustLevel'] = $trustLevel; + + return $self; + } + + /** + * The author's company or organization. + */ + public function withCompany(?string $company): self + { + $self = clone $this; + $self['company'] = $company; + + return $self; + } + + /** + * Author email address. + */ + public function withEmail(?string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * The author's ID from your system. + */ + public function withExternalID(?string $externalID): self + { + $self = clone $this; + $self['externalID'] = $externalID; + + return $self; + } + + /** + * URL of the author's external profile. + */ + public function withExternalLink(?string $externalLink): self + { + $self = clone $this; + $self['externalLink'] = $externalLink; + + return $self; + } + + /** + * Timestamp of last incident. + */ + public function withLastIncident(?float $lastIncident): self + { + $self = clone $this; + $self['lastIncident'] = $lastIncident; + + return $self; + } + + /** + * Author name or identifier. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * URL of the author's profile picture. + */ + public function withProfilePicture(?string $profilePicture): self + { + $self = clone $this; + $self['profilePicture'] = $profilePicture; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Block.php b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Block.php new file mode 100644 index 0000000..20fe1a5 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Block.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + /** + * The moderators reason why the author was blocked or suspended. + */ + #[Optional(nullable: true)] + public ?string $reason; + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + #[Optional(nullable: true)] + public ?float $until; + + 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( + ?string $reason = null, + ?float $until = null + ): self { + $self = new self; + + null !== $reason && $self['reason'] = $reason; + null !== $until && $self['until'] = $until; + + return $self; + } + + /** + * The moderators reason why the author was blocked or suspended. + */ + public function withReason(?string $reason): self + { + $self = clone $this; + $self['reason'] = $reason; + + return $self; + } + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + public function withUntil(?float $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Metadata.php b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Metadata.php new file mode 100644 index 0000000..5a33d3a --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Metadata.php @@ -0,0 +1,119 @@ + */ + use SdkModel; + + /** + * Whether the author's email is verified. + */ + #[Optional('email_verified', nullable: true)] + public ?bool $emailVerified; + + /** + * Whether the author's identity is verified. + */ + #[Optional('identity_verified', nullable: true)] + public ?bool $identityVerified; + + /** + * Whether the author is a paying customer. + */ + #[Optional('is_paying_customer', nullable: true)] + public ?bool $isPayingCustomer; + + /** + * Whether the author's phone number is verified. + */ + #[Optional('phone_verified', nullable: true)] + public ?bool $phoneVerified; + + 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 $emailVerified = null, + ?bool $identityVerified = null, + ?bool $isPayingCustomer = null, + ?bool $phoneVerified = null, + ): self { + $self = new self; + + null !== $emailVerified && $self['emailVerified'] = $emailVerified; + null !== $identityVerified && $self['identityVerified'] = $identityVerified; + null !== $isPayingCustomer && $self['isPayingCustomer'] = $isPayingCustomer; + null !== $phoneVerified && $self['phoneVerified'] = $phoneVerified; + + return $self; + } + + /** + * Whether the author's email is verified. + */ + public function withEmailVerified(?bool $emailVerified): self + { + $self = clone $this; + $self['emailVerified'] = $emailVerified; + + return $self; + } + + /** + * Whether the author's identity is verified. + */ + public function withIdentityVerified(?bool $identityVerified): self + { + $self = clone $this; + $self['identityVerified'] = $identityVerified; + + return $self; + } + + /** + * Whether the author is a paying customer. + */ + public function withIsPayingCustomer(?bool $isPayingCustomer): self + { + $self = clone $this; + $self['isPayingCustomer'] = $isPayingCustomer; + + return $self; + } + + /** + * Whether the author's phone number is verified. + */ + public function withPhoneVerified(?bool $phoneVerified): self + { + $self = clone $this; + $self['phoneVerified'] = $phoneVerified; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Metrics.php b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Metrics.php new file mode 100644 index 0000000..a866062 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Metrics.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Number of flagged content pieces. + */ + #[Required('flagged_content')] + public float $flaggedContent; + + /** + * Total pieces of content. + */ + #[Required('total_content')] + public float $totalContent; + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + #[Optional('average_sentiment', nullable: true)] + public ?float $averageSentiment; + + /** + * `new Metrics()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metrics::with(flaggedContent: ..., totalContent: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metrics)->withFlaggedContent(...)->withTotalContent(...) + * ``` + */ + 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( + float $flaggedContent, + float $totalContent, + ?float $averageSentiment = null + ): self { + $self = new self; + + $self['flaggedContent'] = $flaggedContent; + $self['totalContent'] = $totalContent; + + null !== $averageSentiment && $self['averageSentiment'] = $averageSentiment; + + return $self; + } + + /** + * Number of flagged content pieces. + */ + public function withFlaggedContent(float $flaggedContent): self + { + $self = clone $this; + $self['flaggedContent'] = $flaggedContent; + + return $self; + } + + /** + * Total pieces of content. + */ + public function withTotalContent(float $totalContent): self + { + $self = clone $this; + $self['totalContent'] = $totalContent; + + return $self; + } + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + public function withAverageSentiment(?float $averageSentiment): self + { + $self = clone $this; + $self['averageSentiment'] = $averageSentiment; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/RiskEvaluation.php b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/RiskEvaluation.php new file mode 100644 index 0000000..67d27ef --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/RiskEvaluation.php @@ -0,0 +1,56 @@ + */ + use SdkModel; + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + #[Optional('risk_level', nullable: true)] + public ?float $riskLevel; + + 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(?float $riskLevel = null): self + { + $self = new self; + + null !== $riskLevel && $self['riskLevel'] = $riskLevel; + + return $self; + } + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + public function withRiskLevel(?float $riskLevel): self + { + $self = clone $this; + $self['riskLevel'] = $riskLevel; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Status.php b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Status.php new file mode 100644 index 0000000..17e19f3 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Author/Status.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + #[Required] + public float $level; + + /** + * True if the trust level was set manually by a moderator. + */ + #[Required] + public bool $manual; + + /** + * `new TrustLevel()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * TrustLevel::with(level: ..., manual: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new TrustLevel)->withLevel(...)->withManual(...) + * ``` + */ + 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(float $level, bool $manual): self + { + $self = new self; + + $self['level'] = $level; + $self['manual'] = $manual; + + return $self; + } + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + public function withLevel(float $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * True if the trust level was set manually by a moderator. + */ + public function withManual(bool $manual): self + { + $self = clone $this; + $self['manual'] = $manual; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Queue.php b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Queue.php new file mode 100644 index 0000000..db60222 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorSuspendedEvent/Data/Object_/Queue.php @@ -0,0 +1,64 @@ + */ + use SdkModel; + + #[Required] + public string $id; + + /** + * `new Queue()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Queue::with(id: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Queue)->withID(...) + * ``` + */ + 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(string $id): self + { + $self = new self; + + $self['id'] = $id; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent.php b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent.php new file mode 100644 index 0000000..f4b2403 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent.php @@ -0,0 +1,151 @@ + */ + use SdkModel; + + /** @var 'v2' $apiVersion */ + #[Required('api_version')] + public string $apiVersion = 'v2'; + + /** + * The event type. + * + * @var 'author.trust_level_changed' $type + */ + #[Required] + public string $type = 'author.trust_level_changed'; + + /** + * Stable event ID. Use this to dedupe retries. + */ + #[Required] + public string $id; + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + #[Required] + public \DateTimeInterface $created; + + #[Required] + public Data $data; + + /** + * `new AuthorTrustLevelChangedEvent()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AuthorTrustLevelChangedEvent::with(id: ..., created: ..., data: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AuthorTrustLevelChangedEvent)->withID(...)->withCreated(...)->withData(...) + * ``` + */ + 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. + * + * @param Data|DataShape $data + */ + public static function with( + string $id, + \DateTimeInterface $created, + Data|array $data + ): self { + $self = new self; + + $self['id'] = $id; + $self['created'] = $created; + $self['data'] = $data; + + return $self; + } + + /** + * Stable event ID. Use this to dedupe retries. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param 'v2' $apiVersion + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + public function withCreated(\DateTimeInterface $created): self + { + $self = clone $this; + $self['created'] = $created; + + return $self; + } + + /** + * @param Data|DataShape $data + */ + public function withData(Data|array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * The event type. + * + * @param 'author.trust_level_changed' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data.php b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data.php new file mode 100644 index 0000000..c8bb915 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + #[Required] + public Object_ $object; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with(object: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data)->withObject(...) + * ``` + */ + 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. + * + * @param Object_|ObjectShape $object + */ + public static function with(Object_|array $object): self + { + $self = new self; + + $self['object'] = $object; + + return $self; + } + + /** + * @param Object_|ObjectShape $object + */ + public function withObject(Object_|array $object): self + { + $self = clone $this; + $self['object'] = $object; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_.php b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_.php new file mode 100644 index 0000000..9293b52 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_.php @@ -0,0 +1,416 @@ +, + * trustLevel: TrustLevel|TrustLevelShape, + * company?: string|null, + * email?: string|null, + * externalID?: string|null, + * externalLink?: string|null, + * lastIncident?: float|null, + * name?: string|null, + * profilePicture?: string|null, + * } + */ +final class Object_ implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Author ID in Moderation API. + */ + #[Required] + public string $id; + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + */ + #[Required] + public ?Block $block; + + /** + * Timestamp when author first appeared. + */ + #[Required('first_seen')] + public float $firstSeen; + + /** + * Timestamp of last activity. + */ + #[Required('last_seen')] + public float $lastSeen; + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + */ + #[Required] + public Metadata $metadata; + + #[Required] + public Metrics $metrics; + + /** + * Risk assessment details, if available. + */ + #[Required('risk_evaluation')] + public ?RiskEvaluation $riskEvaluation; + + /** + * Current author status. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + #[Required('trust_level')] + public TrustLevel $trustLevel; + + /** + * The author's company or organization. + */ + #[Optional(nullable: true)] + public ?string $company; + + /** + * Author email address. + */ + #[Optional(nullable: true)] + public ?string $email; + + /** + * The author's ID from your system. + */ + #[Optional('external_id', nullable: true)] + public ?string $externalID; + + /** + * URL of the author's external profile. + */ + #[Optional('external_link', nullable: true)] + public ?string $externalLink; + + /** + * Timestamp of last incident. + */ + #[Optional('last_incident', nullable: true)] + public ?float $lastIncident; + + /** + * Author name or identifier. + */ + #[Optional(nullable: true)] + public ?string $name; + + /** + * URL of the author's profile picture. + */ + #[Optional('profile_picture', nullable: true)] + public ?string $profilePicture; + + /** + * `new Object_()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Object_::with( + * id: ..., + * block: ..., + * firstSeen: ..., + * lastSeen: ..., + * metadata: ..., + * metrics: ..., + * riskEvaluation: ..., + * status: ..., + * trustLevel: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Object_) + * ->withID(...) + * ->withBlock(...) + * ->withFirstSeen(...) + * ->withLastSeen(...) + * ->withMetadata(...) + * ->withMetrics(...) + * ->withRiskEvaluation(...) + * ->withStatus(...) + * ->withTrustLevel(...) + * ``` + */ + 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. + * + * @param Block|BlockShape|null $block + * @param Metadata|MetadataShape $metadata + * @param Metrics|MetricsShape $metrics + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + * @param Status|value-of $status + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public static function with( + string $id, + Block|array|null $block, + float $firstSeen, + float $lastSeen, + Metadata|array $metadata, + Metrics|array $metrics, + RiskEvaluation|array|null $riskEvaluation, + Status|string $status, + TrustLevel|array $trustLevel, + ?string $company = null, + ?string $email = null, + ?string $externalID = null, + ?string $externalLink = null, + ?float $lastIncident = null, + ?string $name = null, + ?string $profilePicture = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['block'] = $block; + $self['firstSeen'] = $firstSeen; + $self['lastSeen'] = $lastSeen; + $self['metadata'] = $metadata; + $self['metrics'] = $metrics; + $self['riskEvaluation'] = $riskEvaluation; + $self['status'] = $status; + $self['trustLevel'] = $trustLevel; + + null !== $company && $self['company'] = $company; + null !== $email && $self['email'] = $email; + null !== $externalID && $self['externalID'] = $externalID; + null !== $externalLink && $self['externalLink'] = $externalLink; + null !== $lastIncident && $self['lastIncident'] = $lastIncident; + null !== $name && $self['name'] = $name; + null !== $profilePicture && $self['profilePicture'] = $profilePicture; + + return $self; + } + + /** + * Author ID in Moderation API. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + * + * @param Block|BlockShape|null $block + */ + public function withBlock(Block|array|null $block): self + { + $self = clone $this; + $self['block'] = $block; + + return $self; + } + + /** + * Timestamp when author first appeared. + */ + public function withFirstSeen(float $firstSeen): self + { + $self = clone $this; + $self['firstSeen'] = $firstSeen; + + return $self; + } + + /** + * Timestamp of last activity. + */ + public function withLastSeen(float $lastSeen): self + { + $self = clone $this; + $self['lastSeen'] = $lastSeen; + + return $self; + } + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * @param Metrics|MetricsShape $metrics + */ + public function withMetrics(Metrics|array $metrics): self + { + $self = clone $this; + $self['metrics'] = $metrics; + + return $self; + } + + /** + * Risk assessment details, if available. + * + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + */ + public function withRiskEvaluation( + RiskEvaluation|array|null $riskEvaluation + ): self { + $self = clone $this; + $self['riskEvaluation'] = $riskEvaluation; + + return $self; + } + + /** + * Current author status. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public function withTrustLevel(TrustLevel|array $trustLevel): self + { + $self = clone $this; + $self['trustLevel'] = $trustLevel; + + return $self; + } + + /** + * The author's company or organization. + */ + public function withCompany(?string $company): self + { + $self = clone $this; + $self['company'] = $company; + + return $self; + } + + /** + * Author email address. + */ + public function withEmail(?string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * The author's ID from your system. + */ + public function withExternalID(?string $externalID): self + { + $self = clone $this; + $self['externalID'] = $externalID; + + return $self; + } + + /** + * URL of the author's external profile. + */ + public function withExternalLink(?string $externalLink): self + { + $self = clone $this; + $self['externalLink'] = $externalLink; + + return $self; + } + + /** + * Timestamp of last incident. + */ + public function withLastIncident(?float $lastIncident): self + { + $self = clone $this; + $self['lastIncident'] = $lastIncident; + + return $self; + } + + /** + * Author name or identifier. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * URL of the author's profile picture. + */ + public function withProfilePicture(?string $profilePicture): self + { + $self = clone $this; + $self['profilePicture'] = $profilePicture; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Block.php b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Block.php new file mode 100644 index 0000000..0bfb6ff --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Block.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + /** + * The moderators reason why the author was blocked or suspended. + */ + #[Optional(nullable: true)] + public ?string $reason; + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + #[Optional(nullable: true)] + public ?float $until; + + 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( + ?string $reason = null, + ?float $until = null + ): self { + $self = new self; + + null !== $reason && $self['reason'] = $reason; + null !== $until && $self['until'] = $until; + + return $self; + } + + /** + * The moderators reason why the author was blocked or suspended. + */ + public function withReason(?string $reason): self + { + $self = clone $this; + $self['reason'] = $reason; + + return $self; + } + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + public function withUntil(?float $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Metadata.php b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Metadata.php new file mode 100644 index 0000000..f0707b2 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Metadata.php @@ -0,0 +1,119 @@ + */ + use SdkModel; + + /** + * Whether the author's email is verified. + */ + #[Optional('email_verified', nullable: true)] + public ?bool $emailVerified; + + /** + * Whether the author's identity is verified. + */ + #[Optional('identity_verified', nullable: true)] + public ?bool $identityVerified; + + /** + * Whether the author is a paying customer. + */ + #[Optional('is_paying_customer', nullable: true)] + public ?bool $isPayingCustomer; + + /** + * Whether the author's phone number is verified. + */ + #[Optional('phone_verified', nullable: true)] + public ?bool $phoneVerified; + + 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 $emailVerified = null, + ?bool $identityVerified = null, + ?bool $isPayingCustomer = null, + ?bool $phoneVerified = null, + ): self { + $self = new self; + + null !== $emailVerified && $self['emailVerified'] = $emailVerified; + null !== $identityVerified && $self['identityVerified'] = $identityVerified; + null !== $isPayingCustomer && $self['isPayingCustomer'] = $isPayingCustomer; + null !== $phoneVerified && $self['phoneVerified'] = $phoneVerified; + + return $self; + } + + /** + * Whether the author's email is verified. + */ + public function withEmailVerified(?bool $emailVerified): self + { + $self = clone $this; + $self['emailVerified'] = $emailVerified; + + return $self; + } + + /** + * Whether the author's identity is verified. + */ + public function withIdentityVerified(?bool $identityVerified): self + { + $self = clone $this; + $self['identityVerified'] = $identityVerified; + + return $self; + } + + /** + * Whether the author is a paying customer. + */ + public function withIsPayingCustomer(?bool $isPayingCustomer): self + { + $self = clone $this; + $self['isPayingCustomer'] = $isPayingCustomer; + + return $self; + } + + /** + * Whether the author's phone number is verified. + */ + public function withPhoneVerified(?bool $phoneVerified): self + { + $self = clone $this; + $self['phoneVerified'] = $phoneVerified; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Metrics.php b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Metrics.php new file mode 100644 index 0000000..1adf229 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Metrics.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Number of flagged content pieces. + */ + #[Required('flagged_content')] + public float $flaggedContent; + + /** + * Total pieces of content. + */ + #[Required('total_content')] + public float $totalContent; + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + #[Optional('average_sentiment', nullable: true)] + public ?float $averageSentiment; + + /** + * `new Metrics()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metrics::with(flaggedContent: ..., totalContent: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metrics)->withFlaggedContent(...)->withTotalContent(...) + * ``` + */ + 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( + float $flaggedContent, + float $totalContent, + ?float $averageSentiment = null + ): self { + $self = new self; + + $self['flaggedContent'] = $flaggedContent; + $self['totalContent'] = $totalContent; + + null !== $averageSentiment && $self['averageSentiment'] = $averageSentiment; + + return $self; + } + + /** + * Number of flagged content pieces. + */ + public function withFlaggedContent(float $flaggedContent): self + { + $self = clone $this; + $self['flaggedContent'] = $flaggedContent; + + return $self; + } + + /** + * Total pieces of content. + */ + public function withTotalContent(float $totalContent): self + { + $self = clone $this; + $self['totalContent'] = $totalContent; + + return $self; + } + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + public function withAverageSentiment(?float $averageSentiment): self + { + $self = clone $this; + $self['averageSentiment'] = $averageSentiment; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/RiskEvaluation.php b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/RiskEvaluation.php new file mode 100644 index 0000000..7af9760 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/RiskEvaluation.php @@ -0,0 +1,56 @@ + */ + use SdkModel; + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + #[Optional('risk_level', nullable: true)] + public ?float $riskLevel; + + 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(?float $riskLevel = null): self + { + $self = new self; + + null !== $riskLevel && $self['riskLevel'] = $riskLevel; + + return $self; + } + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + public function withRiskLevel(?float $riskLevel): self + { + $self = clone $this; + $self['riskLevel'] = $riskLevel; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Status.php b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Status.php new file mode 100644 index 0000000..f8bf868 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorTrustLevelChangedEvent/Data/Object_/Status.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + #[Required] + public float $level; + + /** + * True if the trust level was set manually by a moderator. + */ + #[Required] + public bool $manual; + + /** + * `new TrustLevel()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * TrustLevel::with(level: ..., manual: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new TrustLevel)->withLevel(...)->withManual(...) + * ``` + */ + 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(float $level, bool $manual): self + { + $self = new self; + + $self['level'] = $level; + $self['manual'] = $manual; + + return $self; + } + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + public function withLevel(float $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * True if the trust level was set manually by a moderator. + */ + public function withManual(bool $manual): self + { + $self = clone $this; + $self['manual'] = $manual; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUnblockedEvent.php b/src/Queue/WebhookEvent/AuthorUnblockedEvent.php new file mode 100644 index 0000000..503ae23 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUnblockedEvent.php @@ -0,0 +1,151 @@ + */ + use SdkModel; + + /** @var 'v2' $apiVersion */ + #[Required('api_version')] + public string $apiVersion = 'v2'; + + /** + * The event type. + * + * @var 'author.unblocked' $type + */ + #[Required] + public string $type = 'author.unblocked'; + + /** + * Stable event ID. Use this to dedupe retries. + */ + #[Required] + public string $id; + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + #[Required] + public \DateTimeInterface $created; + + #[Required] + public Data $data; + + /** + * `new AuthorUnblockedEvent()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AuthorUnblockedEvent::with(id: ..., created: ..., data: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AuthorUnblockedEvent)->withID(...)->withCreated(...)->withData(...) + * ``` + */ + 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. + * + * @param Data|DataShape $data + */ + public static function with( + string $id, + \DateTimeInterface $created, + Data|array $data + ): self { + $self = new self; + + $self['id'] = $id; + $self['created'] = $created; + $self['data'] = $data; + + return $self; + } + + /** + * Stable event ID. Use this to dedupe retries. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param 'v2' $apiVersion + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + public function withCreated(\DateTimeInterface $created): self + { + $self = clone $this; + $self['created'] = $created; + + return $self; + } + + /** + * @param Data|DataShape $data + */ + public function withData(Data|array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * The event type. + * + * @param 'author.unblocked' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data.php b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data.php new file mode 100644 index 0000000..8a1ea30 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + #[Required] + public Object_ $object; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with(object: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data)->withObject(...) + * ``` + */ + 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. + * + * @param Object_|ObjectShape $object + */ + public static function with(Object_|array $object): self + { + $self = new self; + + $self['object'] = $object; + + return $self; + } + + /** + * @param Object_|ObjectShape $object + */ + public function withObject(Object_|array $object): self + { + $self = clone $this; + $self['object'] = $object; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_.php b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_.php new file mode 100644 index 0000000..6b50e81 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_.php @@ -0,0 +1,213 @@ + */ + use SdkModel; + + /** + * Moderation action ID. + */ + #[Required] + public string $id; + + /** + * The author the action was performed on. + */ + #[Required] + public Author $author; + + /** + * ISO 8601 timestamp of when the action was performed. + */ + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Customer-defined key identifying this action. + */ + #[Required] + public ?string $key; + + /** + * Display name of the action. + */ + #[Required] + public ?string $name; + + /** + * The value passed to the action when it ran. + */ + #[Required] + public ?string $value; + + /** + * The queue the item belongs to, if any. + */ + #[Optional] + public ?Queue $queue; + + /** + * `new Object_()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Object_::with( + * id: ..., author: ..., createdAt: ..., key: ..., name: ..., value: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Object_) + * ->withID(...) + * ->withAuthor(...) + * ->withCreatedAt(...) + * ->withKey(...) + * ->withName(...) + * ->withValue(...) + * ``` + */ + 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. + * + * @param Author|AuthorShape $author + * @param Queue|QueueShape|null $queue + */ + public static function with( + string $id, + Author|array $author, + \DateTimeInterface $createdAt, + ?string $key, + ?string $name, + ?string $value, + Queue|array|null $queue = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['author'] = $author; + $self['createdAt'] = $createdAt; + $self['key'] = $key; + $self['name'] = $name; + $self['value'] = $value; + + null !== $queue && $self['queue'] = $queue; + + return $self; + } + + /** + * Moderation action ID. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * The author the action was performed on. + * + * @param Author|AuthorShape $author + */ + public function withAuthor(Author|array $author): self + { + $self = clone $this; + $self['author'] = $author; + + return $self; + } + + /** + * ISO 8601 timestamp of when the action was performed. + */ + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Customer-defined key identifying this action. + */ + public function withKey(?string $key): self + { + $self = clone $this; + $self['key'] = $key; + + return $self; + } + + /** + * Display name of the action. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * The value passed to the action when it ran. + */ + public function withValue(?string $value): self + { + $self = clone $this; + $self['value'] = $value; + + return $self; + } + + /** + * The queue the item belongs to, if any. + * + * @param Queue|QueueShape $queue + */ + public function withQueue(Queue|array $queue): self + { + $self = clone $this; + $self['queue'] = $queue; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author.php b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author.php new file mode 100644 index 0000000..1dc6acc --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author.php @@ -0,0 +1,418 @@ +, + * trustLevel: TrustLevel|TrustLevelShape, + * company?: string|null, + * email?: string|null, + * externalID?: string|null, + * externalLink?: string|null, + * lastIncident?: float|null, + * name?: string|null, + * profilePicture?: string|null, + * } + */ +final class Author implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Author ID in Moderation API. + */ + #[Required] + public string $id; + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + */ + #[Required] + public ?Block $block; + + /** + * Timestamp when author first appeared. + */ + #[Required('first_seen')] + public float $firstSeen; + + /** + * Timestamp of last activity. + */ + #[Required('last_seen')] + public float $lastSeen; + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + */ + #[Required] + public Metadata $metadata; + + #[Required] + public Metrics $metrics; + + /** + * Risk assessment details, if available. + */ + #[Required('risk_evaluation')] + public ?RiskEvaluation $riskEvaluation; + + /** + * Current author status. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + #[Required('trust_level')] + public TrustLevel $trustLevel; + + /** + * The author's company or organization. + */ + #[Optional(nullable: true)] + public ?string $company; + + /** + * Author email address. + */ + #[Optional(nullable: true)] + public ?string $email; + + /** + * The author's ID from your system. + */ + #[Optional('external_id', nullable: true)] + public ?string $externalID; + + /** + * URL of the author's external profile. + */ + #[Optional('external_link', nullable: true)] + public ?string $externalLink; + + /** + * Timestamp of last incident. + */ + #[Optional('last_incident', nullable: true)] + public ?float $lastIncident; + + /** + * Author name or identifier. + */ + #[Optional(nullable: true)] + public ?string $name; + + /** + * URL of the author's profile picture. + */ + #[Optional('profile_picture', nullable: true)] + public ?string $profilePicture; + + /** + * `new Author()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Author::with( + * id: ..., + * block: ..., + * firstSeen: ..., + * lastSeen: ..., + * metadata: ..., + * metrics: ..., + * riskEvaluation: ..., + * status: ..., + * trustLevel: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Author) + * ->withID(...) + * ->withBlock(...) + * ->withFirstSeen(...) + * ->withLastSeen(...) + * ->withMetadata(...) + * ->withMetrics(...) + * ->withRiskEvaluation(...) + * ->withStatus(...) + * ->withTrustLevel(...) + * ``` + */ + 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. + * + * @param Block|BlockShape|null $block + * @param Metadata|MetadataShape $metadata + * @param Metrics|MetricsShape $metrics + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + * @param Status|value-of $status + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public static function with( + string $id, + Block|array|null $block, + float $firstSeen, + float $lastSeen, + Metadata|array $metadata, + Metrics|array $metrics, + RiskEvaluation|array|null $riskEvaluation, + Status|string $status, + TrustLevel|array $trustLevel, + ?string $company = null, + ?string $email = null, + ?string $externalID = null, + ?string $externalLink = null, + ?float $lastIncident = null, + ?string $name = null, + ?string $profilePicture = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['block'] = $block; + $self['firstSeen'] = $firstSeen; + $self['lastSeen'] = $lastSeen; + $self['metadata'] = $metadata; + $self['metrics'] = $metrics; + $self['riskEvaluation'] = $riskEvaluation; + $self['status'] = $status; + $self['trustLevel'] = $trustLevel; + + null !== $company && $self['company'] = $company; + null !== $email && $self['email'] = $email; + null !== $externalID && $self['externalID'] = $externalID; + null !== $externalLink && $self['externalLink'] = $externalLink; + null !== $lastIncident && $self['lastIncident'] = $lastIncident; + null !== $name && $self['name'] = $name; + null !== $profilePicture && $self['profilePicture'] = $profilePicture; + + return $self; + } + + /** + * Author ID in Moderation API. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + * + * @param Block|BlockShape|null $block + */ + public function withBlock(Block|array|null $block): self + { + $self = clone $this; + $self['block'] = $block; + + return $self; + } + + /** + * Timestamp when author first appeared. + */ + public function withFirstSeen(float $firstSeen): self + { + $self = clone $this; + $self['firstSeen'] = $firstSeen; + + return $self; + } + + /** + * Timestamp of last activity. + */ + public function withLastSeen(float $lastSeen): self + { + $self = clone $this; + $self['lastSeen'] = $lastSeen; + + return $self; + } + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * @param Metrics|MetricsShape $metrics + */ + public function withMetrics(Metrics|array $metrics): self + { + $self = clone $this; + $self['metrics'] = $metrics; + + return $self; + } + + /** + * Risk assessment details, if available. + * + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + */ + public function withRiskEvaluation( + RiskEvaluation|array|null $riskEvaluation + ): self { + $self = clone $this; + $self['riskEvaluation'] = $riskEvaluation; + + return $self; + } + + /** + * Current author status. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public function withTrustLevel(TrustLevel|array $trustLevel): self + { + $self = clone $this; + $self['trustLevel'] = $trustLevel; + + return $self; + } + + /** + * The author's company or organization. + */ + public function withCompany(?string $company): self + { + $self = clone $this; + $self['company'] = $company; + + return $self; + } + + /** + * Author email address. + */ + public function withEmail(?string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * The author's ID from your system. + */ + public function withExternalID(?string $externalID): self + { + $self = clone $this; + $self['externalID'] = $externalID; + + return $self; + } + + /** + * URL of the author's external profile. + */ + public function withExternalLink(?string $externalLink): self + { + $self = clone $this; + $self['externalLink'] = $externalLink; + + return $self; + } + + /** + * Timestamp of last incident. + */ + public function withLastIncident(?float $lastIncident): self + { + $self = clone $this; + $self['lastIncident'] = $lastIncident; + + return $self; + } + + /** + * Author name or identifier. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * URL of the author's profile picture. + */ + public function withProfilePicture(?string $profilePicture): self + { + $self = clone $this; + $self['profilePicture'] = $profilePicture; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Block.php b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Block.php new file mode 100644 index 0000000..23f9ee4 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Block.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + /** + * The moderators reason why the author was blocked or suspended. + */ + #[Optional(nullable: true)] + public ?string $reason; + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + #[Optional(nullable: true)] + public ?float $until; + + 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( + ?string $reason = null, + ?float $until = null + ): self { + $self = new self; + + null !== $reason && $self['reason'] = $reason; + null !== $until && $self['until'] = $until; + + return $self; + } + + /** + * The moderators reason why the author was blocked or suspended. + */ + public function withReason(?string $reason): self + { + $self = clone $this; + $self['reason'] = $reason; + + return $self; + } + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + public function withUntil(?float $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Metadata.php b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Metadata.php new file mode 100644 index 0000000..a95f304 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Metadata.php @@ -0,0 +1,119 @@ + */ + use SdkModel; + + /** + * Whether the author's email is verified. + */ + #[Optional('email_verified', nullable: true)] + public ?bool $emailVerified; + + /** + * Whether the author's identity is verified. + */ + #[Optional('identity_verified', nullable: true)] + public ?bool $identityVerified; + + /** + * Whether the author is a paying customer. + */ + #[Optional('is_paying_customer', nullable: true)] + public ?bool $isPayingCustomer; + + /** + * Whether the author's phone number is verified. + */ + #[Optional('phone_verified', nullable: true)] + public ?bool $phoneVerified; + + 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 $emailVerified = null, + ?bool $identityVerified = null, + ?bool $isPayingCustomer = null, + ?bool $phoneVerified = null, + ): self { + $self = new self; + + null !== $emailVerified && $self['emailVerified'] = $emailVerified; + null !== $identityVerified && $self['identityVerified'] = $identityVerified; + null !== $isPayingCustomer && $self['isPayingCustomer'] = $isPayingCustomer; + null !== $phoneVerified && $self['phoneVerified'] = $phoneVerified; + + return $self; + } + + /** + * Whether the author's email is verified. + */ + public function withEmailVerified(?bool $emailVerified): self + { + $self = clone $this; + $self['emailVerified'] = $emailVerified; + + return $self; + } + + /** + * Whether the author's identity is verified. + */ + public function withIdentityVerified(?bool $identityVerified): self + { + $self = clone $this; + $self['identityVerified'] = $identityVerified; + + return $self; + } + + /** + * Whether the author is a paying customer. + */ + public function withIsPayingCustomer(?bool $isPayingCustomer): self + { + $self = clone $this; + $self['isPayingCustomer'] = $isPayingCustomer; + + return $self; + } + + /** + * Whether the author's phone number is verified. + */ + public function withPhoneVerified(?bool $phoneVerified): self + { + $self = clone $this; + $self['phoneVerified'] = $phoneVerified; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Metrics.php b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Metrics.php new file mode 100644 index 0000000..e656ef0 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Metrics.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Number of flagged content pieces. + */ + #[Required('flagged_content')] + public float $flaggedContent; + + /** + * Total pieces of content. + */ + #[Required('total_content')] + public float $totalContent; + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + #[Optional('average_sentiment', nullable: true)] + public ?float $averageSentiment; + + /** + * `new Metrics()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metrics::with(flaggedContent: ..., totalContent: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metrics)->withFlaggedContent(...)->withTotalContent(...) + * ``` + */ + 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( + float $flaggedContent, + float $totalContent, + ?float $averageSentiment = null + ): self { + $self = new self; + + $self['flaggedContent'] = $flaggedContent; + $self['totalContent'] = $totalContent; + + null !== $averageSentiment && $self['averageSentiment'] = $averageSentiment; + + return $self; + } + + /** + * Number of flagged content pieces. + */ + public function withFlaggedContent(float $flaggedContent): self + { + $self = clone $this; + $self['flaggedContent'] = $flaggedContent; + + return $self; + } + + /** + * Total pieces of content. + */ + public function withTotalContent(float $totalContent): self + { + $self = clone $this; + $self['totalContent'] = $totalContent; + + return $self; + } + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + public function withAverageSentiment(?float $averageSentiment): self + { + $self = clone $this; + $self['averageSentiment'] = $averageSentiment; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/RiskEvaluation.php b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/RiskEvaluation.php new file mode 100644 index 0000000..51a38e5 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/RiskEvaluation.php @@ -0,0 +1,56 @@ + */ + use SdkModel; + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + #[Optional('risk_level', nullable: true)] + public ?float $riskLevel; + + 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(?float $riskLevel = null): self + { + $self = new self; + + null !== $riskLevel && $self['riskLevel'] = $riskLevel; + + return $self; + } + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + public function withRiskLevel(?float $riskLevel): self + { + $self = clone $this; + $self['riskLevel'] = $riskLevel; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Status.php b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Status.php new file mode 100644 index 0000000..4519a8c --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Author/Status.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + #[Required] + public float $level; + + /** + * True if the trust level was set manually by a moderator. + */ + #[Required] + public bool $manual; + + /** + * `new TrustLevel()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * TrustLevel::with(level: ..., manual: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new TrustLevel)->withLevel(...)->withManual(...) + * ``` + */ + 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(float $level, bool $manual): self + { + $self = new self; + + $self['level'] = $level; + $self['manual'] = $manual; + + return $self; + } + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + public function withLevel(float $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * True if the trust level was set manually by a moderator. + */ + public function withManual(bool $manual): self + { + $self = clone $this; + $self['manual'] = $manual; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Queue.php b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Queue.php new file mode 100644 index 0000000..3330720 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUnblockedEvent/Data/Object_/Queue.php @@ -0,0 +1,64 @@ + */ + use SdkModel; + + #[Required] + public string $id; + + /** + * `new Queue()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Queue::with(id: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Queue)->withID(...) + * ``` + */ + 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(string $id): self + { + $self = new self; + + $self['id'] = $id; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUpdatedEvent.php b/src/Queue/WebhookEvent/AuthorUpdatedEvent.php new file mode 100644 index 0000000..e8673d4 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUpdatedEvent.php @@ -0,0 +1,151 @@ + */ + use SdkModel; + + /** @var 'v2' $apiVersion */ + #[Required('api_version')] + public string $apiVersion = 'v2'; + + /** + * The event type. + * + * @var 'author.updated' $type + */ + #[Required] + public string $type = 'author.updated'; + + /** + * Stable event ID. Use this to dedupe retries. + */ + #[Required] + public string $id; + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + #[Required] + public \DateTimeInterface $created; + + #[Required] + public Data $data; + + /** + * `new AuthorUpdatedEvent()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AuthorUpdatedEvent::with(id: ..., created: ..., data: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AuthorUpdatedEvent)->withID(...)->withCreated(...)->withData(...) + * ``` + */ + 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. + * + * @param Data|DataShape $data + */ + public static function with( + string $id, + \DateTimeInterface $created, + Data|array $data + ): self { + $self = new self; + + $self['id'] = $id; + $self['created'] = $created; + $self['data'] = $data; + + return $self; + } + + /** + * Stable event ID. Use this to dedupe retries. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param 'v2' $apiVersion + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + public function withCreated(\DateTimeInterface $created): self + { + $self = clone $this; + $self['created'] = $created; + + return $self; + } + + /** + * @param Data|DataShape $data + */ + public function withData(Data|array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * The event type. + * + * @param 'author.updated' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data.php b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data.php new file mode 100644 index 0000000..73d57e1 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + #[Required] + public Object_ $object; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with(object: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data)->withObject(...) + * ``` + */ + 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. + * + * @param Object_|ObjectShape $object + */ + public static function with(Object_|array $object): self + { + $self = new self; + + $self['object'] = $object; + + return $self; + } + + /** + * @param Object_|ObjectShape $object + */ + public function withObject(Object_|array $object): self + { + $self = clone $this; + $self['object'] = $object; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_.php b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_.php new file mode 100644 index 0000000..457e227 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_.php @@ -0,0 +1,416 @@ +, + * trustLevel: TrustLevel|TrustLevelShape, + * company?: string|null, + * email?: string|null, + * externalID?: string|null, + * externalLink?: string|null, + * lastIncident?: float|null, + * name?: string|null, + * profilePicture?: string|null, + * } + */ +final class Object_ implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Author ID in Moderation API. + */ + #[Required] + public string $id; + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + */ + #[Required] + public ?Block $block; + + /** + * Timestamp when author first appeared. + */ + #[Required('first_seen')] + public float $firstSeen; + + /** + * Timestamp of last activity. + */ + #[Required('last_seen')] + public float $lastSeen; + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + */ + #[Required] + public Metadata $metadata; + + #[Required] + public Metrics $metrics; + + /** + * Risk assessment details, if available. + */ + #[Required('risk_evaluation')] + public ?RiskEvaluation $riskEvaluation; + + /** + * Current author status. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + #[Required('trust_level')] + public TrustLevel $trustLevel; + + /** + * The author's company or organization. + */ + #[Optional(nullable: true)] + public ?string $company; + + /** + * Author email address. + */ + #[Optional(nullable: true)] + public ?string $email; + + /** + * The author's ID from your system. + */ + #[Optional('external_id', nullable: true)] + public ?string $externalID; + + /** + * URL of the author's external profile. + */ + #[Optional('external_link', nullable: true)] + public ?string $externalLink; + + /** + * Timestamp of last incident. + */ + #[Optional('last_incident', nullable: true)] + public ?float $lastIncident; + + /** + * Author name or identifier. + */ + #[Optional(nullable: true)] + public ?string $name; + + /** + * URL of the author's profile picture. + */ + #[Optional('profile_picture', nullable: true)] + public ?string $profilePicture; + + /** + * `new Object_()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Object_::with( + * id: ..., + * block: ..., + * firstSeen: ..., + * lastSeen: ..., + * metadata: ..., + * metrics: ..., + * riskEvaluation: ..., + * status: ..., + * trustLevel: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Object_) + * ->withID(...) + * ->withBlock(...) + * ->withFirstSeen(...) + * ->withLastSeen(...) + * ->withMetadata(...) + * ->withMetrics(...) + * ->withRiskEvaluation(...) + * ->withStatus(...) + * ->withTrustLevel(...) + * ``` + */ + 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. + * + * @param Block|BlockShape|null $block + * @param Metadata|MetadataShape $metadata + * @param Metrics|MetricsShape $metrics + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + * @param Status|value-of $status + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public static function with( + string $id, + Block|array|null $block, + float $firstSeen, + float $lastSeen, + Metadata|array $metadata, + Metrics|array $metrics, + RiskEvaluation|array|null $riskEvaluation, + Status|string $status, + TrustLevel|array $trustLevel, + ?string $company = null, + ?string $email = null, + ?string $externalID = null, + ?string $externalLink = null, + ?float $lastIncident = null, + ?string $name = null, + ?string $profilePicture = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['block'] = $block; + $self['firstSeen'] = $firstSeen; + $self['lastSeen'] = $lastSeen; + $self['metadata'] = $metadata; + $self['metrics'] = $metrics; + $self['riskEvaluation'] = $riskEvaluation; + $self['status'] = $status; + $self['trustLevel'] = $trustLevel; + + null !== $company && $self['company'] = $company; + null !== $email && $self['email'] = $email; + null !== $externalID && $self['externalID'] = $externalID; + null !== $externalLink && $self['externalLink'] = $externalLink; + null !== $lastIncident && $self['lastIncident'] = $lastIncident; + null !== $name && $self['name'] = $name; + null !== $profilePicture && $self['profilePicture'] = $profilePicture; + + return $self; + } + + /** + * Author ID in Moderation API. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + * + * @param Block|BlockShape|null $block + */ + public function withBlock(Block|array|null $block): self + { + $self = clone $this; + $self['block'] = $block; + + return $self; + } + + /** + * Timestamp when author first appeared. + */ + public function withFirstSeen(float $firstSeen): self + { + $self = clone $this; + $self['firstSeen'] = $firstSeen; + + return $self; + } + + /** + * Timestamp of last activity. + */ + public function withLastSeen(float $lastSeen): self + { + $self = clone $this; + $self['lastSeen'] = $lastSeen; + + return $self; + } + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * @param Metrics|MetricsShape $metrics + */ + public function withMetrics(Metrics|array $metrics): self + { + $self = clone $this; + $self['metrics'] = $metrics; + + return $self; + } + + /** + * Risk assessment details, if available. + * + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + */ + public function withRiskEvaluation( + RiskEvaluation|array|null $riskEvaluation + ): self { + $self = clone $this; + $self['riskEvaluation'] = $riskEvaluation; + + return $self; + } + + /** + * Current author status. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public function withTrustLevel(TrustLevel|array $trustLevel): self + { + $self = clone $this; + $self['trustLevel'] = $trustLevel; + + return $self; + } + + /** + * The author's company or organization. + */ + public function withCompany(?string $company): self + { + $self = clone $this; + $self['company'] = $company; + + return $self; + } + + /** + * Author email address. + */ + public function withEmail(?string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * The author's ID from your system. + */ + public function withExternalID(?string $externalID): self + { + $self = clone $this; + $self['externalID'] = $externalID; + + return $self; + } + + /** + * URL of the author's external profile. + */ + public function withExternalLink(?string $externalLink): self + { + $self = clone $this; + $self['externalLink'] = $externalLink; + + return $self; + } + + /** + * Timestamp of last incident. + */ + public function withLastIncident(?float $lastIncident): self + { + $self = clone $this; + $self['lastIncident'] = $lastIncident; + + return $self; + } + + /** + * Author name or identifier. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * URL of the author's profile picture. + */ + public function withProfilePicture(?string $profilePicture): self + { + $self = clone $this; + $self['profilePicture'] = $profilePicture; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Block.php b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Block.php new file mode 100644 index 0000000..25e2936 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Block.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + /** + * The moderators reason why the author was blocked or suspended. + */ + #[Optional(nullable: true)] + public ?string $reason; + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + #[Optional(nullable: true)] + public ?float $until; + + 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( + ?string $reason = null, + ?float $until = null + ): self { + $self = new self; + + null !== $reason && $self['reason'] = $reason; + null !== $until && $self['until'] = $until; + + return $self; + } + + /** + * The moderators reason why the author was blocked or suspended. + */ + public function withReason(?string $reason): self + { + $self = clone $this; + $self['reason'] = $reason; + + return $self; + } + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + public function withUntil(?float $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Metadata.php b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Metadata.php new file mode 100644 index 0000000..a3a4369 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Metadata.php @@ -0,0 +1,119 @@ + */ + use SdkModel; + + /** + * Whether the author's email is verified. + */ + #[Optional('email_verified', nullable: true)] + public ?bool $emailVerified; + + /** + * Whether the author's identity is verified. + */ + #[Optional('identity_verified', nullable: true)] + public ?bool $identityVerified; + + /** + * Whether the author is a paying customer. + */ + #[Optional('is_paying_customer', nullable: true)] + public ?bool $isPayingCustomer; + + /** + * Whether the author's phone number is verified. + */ + #[Optional('phone_verified', nullable: true)] + public ?bool $phoneVerified; + + 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 $emailVerified = null, + ?bool $identityVerified = null, + ?bool $isPayingCustomer = null, + ?bool $phoneVerified = null, + ): self { + $self = new self; + + null !== $emailVerified && $self['emailVerified'] = $emailVerified; + null !== $identityVerified && $self['identityVerified'] = $identityVerified; + null !== $isPayingCustomer && $self['isPayingCustomer'] = $isPayingCustomer; + null !== $phoneVerified && $self['phoneVerified'] = $phoneVerified; + + return $self; + } + + /** + * Whether the author's email is verified. + */ + public function withEmailVerified(?bool $emailVerified): self + { + $self = clone $this; + $self['emailVerified'] = $emailVerified; + + return $self; + } + + /** + * Whether the author's identity is verified. + */ + public function withIdentityVerified(?bool $identityVerified): self + { + $self = clone $this; + $self['identityVerified'] = $identityVerified; + + return $self; + } + + /** + * Whether the author is a paying customer. + */ + public function withIsPayingCustomer(?bool $isPayingCustomer): self + { + $self = clone $this; + $self['isPayingCustomer'] = $isPayingCustomer; + + return $self; + } + + /** + * Whether the author's phone number is verified. + */ + public function withPhoneVerified(?bool $phoneVerified): self + { + $self = clone $this; + $self['phoneVerified'] = $phoneVerified; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Metrics.php b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Metrics.php new file mode 100644 index 0000000..5b4c5b6 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Metrics.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Number of flagged content pieces. + */ + #[Required('flagged_content')] + public float $flaggedContent; + + /** + * Total pieces of content. + */ + #[Required('total_content')] + public float $totalContent; + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + #[Optional('average_sentiment', nullable: true)] + public ?float $averageSentiment; + + /** + * `new Metrics()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metrics::with(flaggedContent: ..., totalContent: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metrics)->withFlaggedContent(...)->withTotalContent(...) + * ``` + */ + 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( + float $flaggedContent, + float $totalContent, + ?float $averageSentiment = null + ): self { + $self = new self; + + $self['flaggedContent'] = $flaggedContent; + $self['totalContent'] = $totalContent; + + null !== $averageSentiment && $self['averageSentiment'] = $averageSentiment; + + return $self; + } + + /** + * Number of flagged content pieces. + */ + public function withFlaggedContent(float $flaggedContent): self + { + $self = clone $this; + $self['flaggedContent'] = $flaggedContent; + + return $self; + } + + /** + * Total pieces of content. + */ + public function withTotalContent(float $totalContent): self + { + $self = clone $this; + $self['totalContent'] = $totalContent; + + return $self; + } + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + public function withAverageSentiment(?float $averageSentiment): self + { + $self = clone $this; + $self['averageSentiment'] = $averageSentiment; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/RiskEvaluation.php b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/RiskEvaluation.php new file mode 100644 index 0000000..6894881 --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/RiskEvaluation.php @@ -0,0 +1,56 @@ + */ + use SdkModel; + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + #[Optional('risk_level', nullable: true)] + public ?float $riskLevel; + + 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(?float $riskLevel = null): self + { + $self = new self; + + null !== $riskLevel && $self['riskLevel'] = $riskLevel; + + return $self; + } + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + public function withRiskLevel(?float $riskLevel): self + { + $self = clone $this; + $self['riskLevel'] = $riskLevel; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Status.php b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Status.php new file mode 100644 index 0000000..6a94f2c --- /dev/null +++ b/src/Queue/WebhookEvent/AuthorUpdatedEvent/Data/Object_/Status.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + #[Required] + public float $level; + + /** + * True if the trust level was set manually by a moderator. + */ + #[Required] + public bool $manual; + + /** + * `new TrustLevel()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * TrustLevel::with(level: ..., manual: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new TrustLevel)->withLevel(...)->withManual(...) + * ``` + */ + 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(float $level, bool $manual): self + { + $self = new self; + + $self['level'] = $level; + $self['manual'] = $manual; + + return $self; + } + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + public function withLevel(float $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * True if the trust level was set manually by a moderator. + */ + public function withManual(bool $manual): self + { + $self = clone $this; + $self['manual'] = $manual; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/QueueItemActionEvent.php b/src/Queue/WebhookEvent/QueueItemActionEvent.php new file mode 100644 index 0000000..cac806a --- /dev/null +++ b/src/Queue/WebhookEvent/QueueItemActionEvent.php @@ -0,0 +1,151 @@ + */ + use SdkModel; + + /** @var 'v2' $apiVersion */ + #[Required('api_version')] + public string $apiVersion = 'v2'; + + /** + * The event type. + * + * @var 'queue_item.action' $type + */ + #[Required] + public string $type = 'queue_item.action'; + + /** + * Stable event ID. Use this to dedupe retries. + */ + #[Required] + public string $id; + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + #[Required] + public \DateTimeInterface $created; + + #[Required] + public Data $data; + + /** + * `new QueueItemActionEvent()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * QueueItemActionEvent::with(id: ..., created: ..., data: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new QueueItemActionEvent)->withID(...)->withCreated(...)->withData(...) + * ``` + */ + 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. + * + * @param Data|DataShape $data + */ + public static function with( + string $id, + \DateTimeInterface $created, + Data|array $data + ): self { + $self = new self; + + $self['id'] = $id; + $self['created'] = $created; + $self['data'] = $data; + + return $self; + } + + /** + * Stable event ID. Use this to dedupe retries. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param 'v2' $apiVersion + */ + public function withAPIVersion(string $apiVersion): self + { + $self = clone $this; + $self['apiVersion'] = $apiVersion; + + return $self; + } + + /** + * ISO 8601 timestamp of when the event was emitted. + */ + public function withCreated(\DateTimeInterface $created): self + { + $self = clone $this; + $self['created'] = $created; + + return $self; + } + + /** + * @param Data|DataShape $data + */ + public function withData(Data|array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * The event type. + * + * @param 'queue_item.action' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/QueueItemActionEvent/Data.php b/src/Queue/WebhookEvent/QueueItemActionEvent/Data.php new file mode 100644 index 0000000..acd35ac --- /dev/null +++ b/src/Queue/WebhookEvent/QueueItemActionEvent/Data.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + #[Required] + public Object_ $object; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with(object: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data)->withObject(...) + * ``` + */ + 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. + * + * @param Object_|ObjectShape $object + */ + public static function with(Object_|array $object): self + { + $self = new self; + + $self['object'] = $object; + + return $self; + } + + /** + * @param Object_|ObjectShape $object + */ + public function withObject(Object_|array $object): self + { + $self = clone $this; + $self['object'] = $object; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_.php b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_.php new file mode 100644 index 0000000..8be81c2 --- /dev/null +++ b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_.php @@ -0,0 +1,235 @@ + */ + use SdkModel; + + /** + * Moderation action ID. + */ + #[Required] + public string $id; + + /** + * ISO 8601 timestamp of when the action was performed. + */ + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Customer-defined key identifying this action. + */ + #[Required] + public ?string $key; + + /** + * Display name of the action. + */ + #[Required] + public ?string $name; + + /** + * The value passed to the action when it ran. + */ + #[Required] + public ?string $value; + + /** + * The author the action was performed on, if any. + */ + #[Optional] + public ?Author $author; + + /** + * The content item the action was performed on, if any. + */ + #[Optional] + public ?Item $item; + + /** + * The queue the item belongs to, if any. + */ + #[Optional] + public ?Queue $queue; + + /** + * `new Object_()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Object_::with(id: ..., createdAt: ..., key: ..., name: ..., value: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Object_) + * ->withID(...) + * ->withCreatedAt(...) + * ->withKey(...) + * ->withName(...) + * ->withValue(...) + * ``` + */ + 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. + * + * @param Author|AuthorShape|null $author + * @param Item|ItemShape|null $item + * @param Queue|QueueShape|null $queue + */ + public static function with( + string $id, + \DateTimeInterface $createdAt, + ?string $key, + ?string $name, + ?string $value, + Author|array|null $author = null, + Item|array|null $item = null, + Queue|array|null $queue = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['createdAt'] = $createdAt; + $self['key'] = $key; + $self['name'] = $name; + $self['value'] = $value; + + null !== $author && $self['author'] = $author; + null !== $item && $self['item'] = $item; + null !== $queue && $self['queue'] = $queue; + + return $self; + } + + /** + * Moderation action ID. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * ISO 8601 timestamp of when the action was performed. + */ + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Customer-defined key identifying this action. + */ + public function withKey(?string $key): self + { + $self = clone $this; + $self['key'] = $key; + + return $self; + } + + /** + * Display name of the action. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * The value passed to the action when it ran. + */ + public function withValue(?string $value): self + { + $self = clone $this; + $self['value'] = $value; + + return $self; + } + + /** + * The author the action was performed on, if any. + * + * @param Author|AuthorShape $author + */ + public function withAuthor(Author|array $author): self + { + $self = clone $this; + $self['author'] = $author; + + return $self; + } + + /** + * The content item the action was performed on, if any. + * + * @param Item|ItemShape $item + */ + public function withItem(Item|array $item): self + { + $self = clone $this; + $self['item'] = $item; + + return $self; + } + + /** + * The queue the item belongs to, if any. + * + * @param Queue|QueueShape $queue + */ + public function withQueue(Queue|array $queue): self + { + $self = clone $this; + $self['queue'] = $queue; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author.php b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author.php new file mode 100644 index 0000000..40fb2ed --- /dev/null +++ b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author.php @@ -0,0 +1,418 @@ +, + * trustLevel: TrustLevel|TrustLevelShape, + * company?: string|null, + * email?: string|null, + * externalID?: string|null, + * externalLink?: string|null, + * lastIncident?: float|null, + * name?: string|null, + * profilePicture?: string|null, + * } + */ +final class Author implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Author ID in Moderation API. + */ + #[Required] + public string $id; + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + */ + #[Required] + public ?Block $block; + + /** + * Timestamp when author first appeared. + */ + #[Required('first_seen')] + public float $firstSeen; + + /** + * Timestamp of last activity. + */ + #[Required('last_seen')] + public float $lastSeen; + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + */ + #[Required] + public Metadata $metadata; + + #[Required] + public Metrics $metrics; + + /** + * Risk assessment details, if available. + */ + #[Required('risk_evaluation')] + public ?RiskEvaluation $riskEvaluation; + + /** + * Current author status. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + #[Required('trust_level')] + public TrustLevel $trustLevel; + + /** + * The author's company or organization. + */ + #[Optional(nullable: true)] + public ?string $company; + + /** + * Author email address. + */ + #[Optional(nullable: true)] + public ?string $email; + + /** + * The author's ID from your system. + */ + #[Optional('external_id', nullable: true)] + public ?string $externalID; + + /** + * URL of the author's external profile. + */ + #[Optional('external_link', nullable: true)] + public ?string $externalLink; + + /** + * Timestamp of last incident. + */ + #[Optional('last_incident', nullable: true)] + public ?float $lastIncident; + + /** + * Author name or identifier. + */ + #[Optional(nullable: true)] + public ?string $name; + + /** + * URL of the author's profile picture. + */ + #[Optional('profile_picture', nullable: true)] + public ?string $profilePicture; + + /** + * `new Author()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Author::with( + * id: ..., + * block: ..., + * firstSeen: ..., + * lastSeen: ..., + * metadata: ..., + * metrics: ..., + * riskEvaluation: ..., + * status: ..., + * trustLevel: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Author) + * ->withID(...) + * ->withBlock(...) + * ->withFirstSeen(...) + * ->withLastSeen(...) + * ->withMetadata(...) + * ->withMetrics(...) + * ->withRiskEvaluation(...) + * ->withStatus(...) + * ->withTrustLevel(...) + * ``` + */ + 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. + * + * @param Block|BlockShape|null $block + * @param Metadata|MetadataShape $metadata + * @param Metrics|MetricsShape $metrics + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + * @param Status|value-of $status + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public static function with( + string $id, + Block|array|null $block, + float $firstSeen, + float $lastSeen, + Metadata|array $metadata, + Metrics|array $metrics, + RiskEvaluation|array|null $riskEvaluation, + Status|string $status, + TrustLevel|array $trustLevel, + ?string $company = null, + ?string $email = null, + ?string $externalID = null, + ?string $externalLink = null, + ?float $lastIncident = null, + ?string $name = null, + ?string $profilePicture = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['block'] = $block; + $self['firstSeen'] = $firstSeen; + $self['lastSeen'] = $lastSeen; + $self['metadata'] = $metadata; + $self['metrics'] = $metrics; + $self['riskEvaluation'] = $riskEvaluation; + $self['status'] = $status; + $self['trustLevel'] = $trustLevel; + + null !== $company && $self['company'] = $company; + null !== $email && $self['email'] = $email; + null !== $externalID && $self['externalID'] = $externalID; + null !== $externalLink && $self['externalLink'] = $externalLink; + null !== $lastIncident && $self['lastIncident'] = $lastIncident; + null !== $name && $self['name'] = $name; + null !== $profilePicture && $self['profilePicture'] = $profilePicture; + + return $self; + } + + /** + * Author ID in Moderation API. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Block or suspension details, if applicable. Null if the author is enabled. + * + * @param Block|BlockShape|null $block + */ + public function withBlock(Block|array|null $block): self + { + $self = clone $this; + $self['block'] = $block; + + return $self; + } + + /** + * Timestamp when author first appeared. + */ + public function withFirstSeen(float $firstSeen): self + { + $self = clone $this; + $self['firstSeen'] = $firstSeen; + + return $self; + } + + /** + * Timestamp of last activity. + */ + public function withLastSeen(float $lastSeen): self + { + $self = clone $this; + $self['lastSeen'] = $lastSeen; + + return $self; + } + + /** + * Additional metadata provided by your system. We recommend including any relevant information that may assist in the moderation process. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * @param Metrics|MetricsShape $metrics + */ + public function withMetrics(Metrics|array $metrics): self + { + $self = clone $this; + $self['metrics'] = $metrics; + + return $self; + } + + /** + * Risk assessment details, if available. + * + * @param RiskEvaluation|RiskEvaluationShape|null $riskEvaluation + */ + public function withRiskEvaluation( + RiskEvaluation|array|null $riskEvaluation + ): self { + $self = clone $this; + $self['riskEvaluation'] = $riskEvaluation; + + return $self; + } + + /** + * Current author status. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TrustLevel|TrustLevelShape $trustLevel + */ + public function withTrustLevel(TrustLevel|array $trustLevel): self + { + $self = clone $this; + $self['trustLevel'] = $trustLevel; + + return $self; + } + + /** + * The author's company or organization. + */ + public function withCompany(?string $company): self + { + $self = clone $this; + $self['company'] = $company; + + return $self; + } + + /** + * Author email address. + */ + public function withEmail(?string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * The author's ID from your system. + */ + public function withExternalID(?string $externalID): self + { + $self = clone $this; + $self['externalID'] = $externalID; + + return $self; + } + + /** + * URL of the author's external profile. + */ + public function withExternalLink(?string $externalLink): self + { + $self = clone $this; + $self['externalLink'] = $externalLink; + + return $self; + } + + /** + * Timestamp of last incident. + */ + public function withLastIncident(?float $lastIncident): self + { + $self = clone $this; + $self['lastIncident'] = $lastIncident; + + return $self; + } + + /** + * Author name or identifier. + */ + public function withName(?string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * URL of the author's profile picture. + */ + public function withProfilePicture(?string $profilePicture): self + { + $self = clone $this; + $self['profilePicture'] = $profilePicture; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Block.php b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Block.php new file mode 100644 index 0000000..d72c253 --- /dev/null +++ b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Block.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + /** + * The moderators reason why the author was blocked or suspended. + */ + #[Optional(nullable: true)] + public ?string $reason; + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + #[Optional(nullable: true)] + public ?float $until; + + 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( + ?string $reason = null, + ?float $until = null + ): self { + $self = new self; + + null !== $reason && $self['reason'] = $reason; + null !== $until && $self['until'] = $until; + + return $self; + } + + /** + * The moderators reason why the author was blocked or suspended. + */ + public function withReason(?string $reason): self + { + $self = clone $this; + $self['reason'] = $reason; + + return $self; + } + + /** + * The timestamp until which they are blocked if the author is suspended. + */ + public function withUntil(?float $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Metadata.php b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Metadata.php new file mode 100644 index 0000000..c9c15f9 --- /dev/null +++ b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Metadata.php @@ -0,0 +1,119 @@ + */ + use SdkModel; + + /** + * Whether the author's email is verified. + */ + #[Optional('email_verified', nullable: true)] + public ?bool $emailVerified; + + /** + * Whether the author's identity is verified. + */ + #[Optional('identity_verified', nullable: true)] + public ?bool $identityVerified; + + /** + * Whether the author is a paying customer. + */ + #[Optional('is_paying_customer', nullable: true)] + public ?bool $isPayingCustomer; + + /** + * Whether the author's phone number is verified. + */ + #[Optional('phone_verified', nullable: true)] + public ?bool $phoneVerified; + + 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 $emailVerified = null, + ?bool $identityVerified = null, + ?bool $isPayingCustomer = null, + ?bool $phoneVerified = null, + ): self { + $self = new self; + + null !== $emailVerified && $self['emailVerified'] = $emailVerified; + null !== $identityVerified && $self['identityVerified'] = $identityVerified; + null !== $isPayingCustomer && $self['isPayingCustomer'] = $isPayingCustomer; + null !== $phoneVerified && $self['phoneVerified'] = $phoneVerified; + + return $self; + } + + /** + * Whether the author's email is verified. + */ + public function withEmailVerified(?bool $emailVerified): self + { + $self = clone $this; + $self['emailVerified'] = $emailVerified; + + return $self; + } + + /** + * Whether the author's identity is verified. + */ + public function withIdentityVerified(?bool $identityVerified): self + { + $self = clone $this; + $self['identityVerified'] = $identityVerified; + + return $self; + } + + /** + * Whether the author is a paying customer. + */ + public function withIsPayingCustomer(?bool $isPayingCustomer): self + { + $self = clone $this; + $self['isPayingCustomer'] = $isPayingCustomer; + + return $self; + } + + /** + * Whether the author's phone number is verified. + */ + public function withPhoneVerified(?bool $phoneVerified): self + { + $self = clone $this; + $self['phoneVerified'] = $phoneVerified; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Metrics.php b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Metrics.php new file mode 100644 index 0000000..5e65b6a --- /dev/null +++ b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Metrics.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Number of flagged content pieces. + */ + #[Required('flagged_content')] + public float $flaggedContent; + + /** + * Total pieces of content. + */ + #[Required('total_content')] + public float $totalContent; + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + #[Optional('average_sentiment', nullable: true)] + public ?float $averageSentiment; + + /** + * `new Metrics()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metrics::with(flaggedContent: ..., totalContent: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metrics)->withFlaggedContent(...)->withTotalContent(...) + * ``` + */ + 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( + float $flaggedContent, + float $totalContent, + ?float $averageSentiment = null + ): self { + $self = new self; + + $self['flaggedContent'] = $flaggedContent; + $self['totalContent'] = $totalContent; + + null !== $averageSentiment && $self['averageSentiment'] = $averageSentiment; + + return $self; + } + + /** + * Number of flagged content pieces. + */ + public function withFlaggedContent(float $flaggedContent): self + { + $self = clone $this; + $self['flaggedContent'] = $flaggedContent; + + return $self; + } + + /** + * Total pieces of content. + */ + public function withTotalContent(float $totalContent): self + { + $self = clone $this; + $self['totalContent'] = $totalContent; + + return $self; + } + + /** + * Average sentiment score of content (-1 to 1). Requires a sentiment model in your project. + */ + public function withAverageSentiment(?float $averageSentiment): self + { + $self = clone $this; + $self['averageSentiment'] = $averageSentiment; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/RiskEvaluation.php b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/RiskEvaluation.php new file mode 100644 index 0000000..cce923b --- /dev/null +++ b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/RiskEvaluation.php @@ -0,0 +1,56 @@ + */ + use SdkModel; + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + #[Optional('risk_level', nullable: true)] + public ?float $riskLevel; + + 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(?float $riskLevel = null): self + { + $self = new self; + + null !== $riskLevel && $self['riskLevel'] = $riskLevel; + + return $self; + } + + /** + * Calculated risk level based on more than 10 behavioral signals. + */ + public function withRiskLevel(?float $riskLevel): self + { + $self = clone $this; + $self['riskLevel'] = $riskLevel; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Status.php b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Status.php new file mode 100644 index 0000000..3bf33e6 --- /dev/null +++ b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Author/Status.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + #[Required] + public float $level; + + /** + * True if the trust level was set manually by a moderator. + */ + #[Required] + public bool $manual; + + /** + * `new TrustLevel()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * TrustLevel::with(level: ..., manual: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new TrustLevel)->withLevel(...)->withManual(...) + * ``` + */ + 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(float $level, bool $manual): self + { + $self = new self; + + $self['level'] = $level; + $self['manual'] = $manual; + + return $self; + } + + /** + * Author trust level (-1, 0, 1, 2, 3, or 4). + */ + public function withLevel(float $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * True if the trust level was set manually by a moderator. + */ + public function withManual(bool $manual): self + { + $self = clone $this; + $self['manual'] = $manual; + + return $self; + } +} diff --git a/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Item.php b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Item.php new file mode 100644 index 0000000..0aa0452 --- /dev/null +++ b/src/Queue/WebhookEvent/QueueItemActionEvent/Data/Object_/Item.php @@ -0,0 +1,329 @@ +|null, + * language: string|null, + * metaType: null|MetaType|value-of, + * metadata: array|null, + * timestamp: \DateTimeInterface, + * } + */ +final class Item implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Content ID from your system. + */ + #[Required] + public string $id; + + /** + * External author ID (the customer's identifier, not Moderation API's internal id). + */ + #[Required('author_id')] + public ?string $authorID; + + /** + * The channel the content was submitted to, identified by your customer-defined channel key. + */ + #[Required('channel_key')] + public ?string $channelKey; + + /** + * The original content payload. + * + * @var ContentVariants $content + */ + #[Required] + public Text|Image|Video|Audio|Object_ $content; + + /** + * Conversation grouping ID, if any. + */ + #[Required('conversation_id')] + public ?string $conversationID; + + /** + * Whether the content was flagged by moderation. + */ + #[Required] + public ?bool $flagged; + + /** + * Moderation labels applied to the content. + * + * @var list