-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
'Unsafe content detection' functionality
- Loading branch information
1 parent
f7ec091
commit 3d39e99
Showing
16 changed files
with
319 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
api-samples/rest-api/get-addons-aws_rekognition_detect_moderation_labels-execute-status.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
$configuration = Uploadcare\Configuration::create((string) $_ENV['UPLOADCARE_PUBLIC_KEY'], (string) $_ENV['UPLOADCARE_SECRET_KEY']); | ||
$api = (new Uploadcare\Api($configuration))->addons(); | ||
$status = $api->checkAwsRecognitionModeration('request-id'); | ||
|
||
echo \sprintf('Recognition status: %s', $status); |
7 changes: 7 additions & 0 deletions
7
api-samples/rest-api/post-addons-aws_rekognition_detect_moderation_labels-execute.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
$configuration = Uploadcare\Configuration::create((string) $_ENV['UPLOADCARE_PUBLIC_KEY'], (string) $_ENV['UPLOADCARE_SECRET_KEY']); | ||
$api = (new Uploadcare\Api($configuration))->addons(); | ||
$resultKey = $api->requestAwsRecognitionModeration('1bac376c-aa7e-4356-861b-dd2657b5bfd2'); | ||
|
||
echo \sprintf('Recognition requested. Key is \'%s\'', $resultKey); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Uploadcare\File\AppData; | ||
|
||
abstract class AbstractAwsLabels | ||
{ | ||
protected ?string $version = null; | ||
protected ?\DateTimeInterface $datetimeCreated = null; | ||
protected ?\DateTimeInterface $datetimeUpdated = null; | ||
|
||
public function getVersion(): ?string | ||
{ | ||
return $this->version; | ||
} | ||
|
||
public function setVersion(?string $version): self | ||
{ | ||
$this->version = $version; | ||
|
||
return $this; | ||
} | ||
|
||
public function getDatetimeCreated(): ?\DateTimeInterface | ||
{ | ||
return $this->datetimeCreated; | ||
} | ||
|
||
public function setDatetimeCreated(?\DateTimeInterface $datetimeCreated): self | ||
{ | ||
$this->datetimeCreated = $datetimeCreated; | ||
|
||
return $this; | ||
} | ||
|
||
public function getDatetimeUpdated(): ?\DateTimeInterface | ||
{ | ||
return $this->datetimeUpdated; | ||
} | ||
|
||
public function setDatetimeUpdated(?\DateTimeInterface $datetimeUpdated): self | ||
{ | ||
$this->datetimeUpdated = $datetimeUpdated; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Uploadcare\File\AppData; | ||
|
||
use Uploadcare\Interfaces\File\AppData\AwsRecognitionData\AwsModerationLabelInterface; | ||
use Uploadcare\Interfaces\SerializableInterface; | ||
|
||
class AwsModerationLabel implements AwsModerationLabelInterface, SerializableInterface | ||
{ | ||
private ?float $confidence = null; | ||
private ?string $name = null; | ||
private ?string $parentName = null; | ||
|
||
public static function rules(): array | ||
{ | ||
return [ | ||
'confidence' => 'float', | ||
'name' => 'string', | ||
'parentName' => 'string', | ||
]; | ||
} | ||
|
||
public function getConfidence(): ?float | ||
{ | ||
return $this->confidence; | ||
} | ||
|
||
public function setConfidence(?float $confidence): self | ||
{ | ||
$this->confidence = $confidence; | ||
|
||
return $this; | ||
} | ||
|
||
public function getName(): ?string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function setName(?string $name): self | ||
{ | ||
$this->name = $name; | ||
|
||
return $this; | ||
} | ||
|
||
public function getParentName(): ?string | ||
{ | ||
return $this->parentName; | ||
} | ||
|
||
public function setParentName(?string $parentName): self | ||
{ | ||
$this->parentName = $parentName; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Uploadcare\File\AppData; | ||
|
||
use Uploadcare\Interfaces\File\AppData\AwsRecognitionData\AwsRecognitionDataInterface; | ||
use Uploadcare\Interfaces\SerializableInterface; | ||
|
||
class AwsRecognitionModerationData implements AwsRecognitionDataInterface, SerializableInterface | ||
{ | ||
private ?string $labelModelVersion = null; | ||
|
||
/** | ||
* @var AwsModerationLabel[] | ||
*/ | ||
private array $labels = []; | ||
|
||
public static function rules(): array | ||
{ | ||
return [ | ||
'labelModelVersion' => 'string', | ||
'labels' => [AwsModerationLabel::class], | ||
]; | ||
} | ||
|
||
public function getLabelModelVersion(): ?string | ||
{ | ||
return $this->labelModelVersion; | ||
} | ||
|
||
public function setLabelModelVersion(?string $labelModelVersion): self | ||
{ | ||
$this->labelModelVersion = $labelModelVersion; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @return AwsModerationLabel[] | ||
*/ | ||
public function getLabels(): iterable | ||
{ | ||
return $this->labels; | ||
} | ||
|
||
public function addLabel(AwsModerationLabel $label): self | ||
{ | ||
if (!\in_array($label, $this->labels, true)) { | ||
$this->labels[] = $label; | ||
} | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Uploadcare\File\AppData; | ||
|
||
use Uploadcare\Interfaces\File\AppData\AwsRecognitionData\AwsRecognitionDataInterface; | ||
use Uploadcare\Interfaces\File\AppData\AwsRecognitionLabelsInterface; | ||
use Uploadcare\Interfaces\SerializableInterface; | ||
|
||
class AwsRecognitionModerationLabels extends AbstractAwsLabels implements AwsRecognitionLabelsInterface, SerializableInterface | ||
{ | ||
private ?AwsRecognitionModerationData $awsRecognitionData = null; | ||
|
||
public static function rules(): array | ||
{ | ||
return [ | ||
'version' => 'string', | ||
'datetimeCreated' => \DateTime::class, | ||
'datetimeUpdated' => \DateTime::class, | ||
'data' => AwsRecognitionModerationData::class, | ||
]; | ||
} | ||
|
||
public function getData(): ?AwsRecognitionDataInterface | ||
{ | ||
return $this->awsRecognitionData; | ||
} | ||
|
||
public function setData(?AwsRecognitionModerationData $data): self | ||
{ | ||
$this->awsRecognitionData = $data; | ||
|
||
return $this; | ||
} | ||
} |
Oops, something went wrong.