Skip to content

Commit

Permalink
Add AWS Rekognition Moderation add on methods (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
vipulnsward committed May 9, 2024
1 parent 954edc1 commit 0659cc0
Show file tree
Hide file tree
Showing 17 changed files with 651 additions and 16 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based now on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased

### Added
* Added Addons api for `AWS Rekognition Moderation` Add-On.

## 3.4.1 — 2024-03-24

### Fixed
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ post.picture.store
# ...other group data...
# }

#
# Delete the file from an Uploadcare server permanently:
post.picture.delete
# => {
Expand Down Expand Up @@ -422,6 +423,7 @@ post.attachments.store
# }]
# }

#
# Delete the file group from an Uploadcare server permanently:
post.attachments.delete
# => {
Expand Down Expand Up @@ -977,6 +979,25 @@ Uploadcare::AddonsApi.rekognition_detect_labels_status('dfeaf81c-5c0d-49d5-8ed4-
# => {"status"=>"done"}
```

#### Execute AWS Rekognition Moderation Add-On for a given target to detect moderation labels in an image.
```
Note: Detected labels are stored in the file's appdata.
```

```ruby
Uploadcare::AddonsApi.rekognition_detect_moderation_labels('f757ea10-8b1a-4361-9a7c-56bfa5d45176')
# => {"request_id"=>"dfeaf81c-5c0d-49d5-8ed4-ac09bac7998e"}
```

# Check the status of an AWS Rekognition Moderation Add-On execution request that had been started using the Execute Add-On operation.

```ruby
Uploadcare::AddonsApi.rekognition_detect_moderation_labels_status('dfeaf81c-5c0d-49d5-8ed4-ac09bac7998e')
# => {"status"=>"done"}
```



#### Execute ClamAV virus checking Add-On for a given target

```ruby
Expand Down
12 changes: 12 additions & 0 deletions lib/uploadcare/rails/api/rest/addons_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ def remove_bg(uuid, params = {})
def remove_bg_status(uuid)
Uploadcare::Addons.remove_bg_status(uuid)
end

# Execute AWS Rekognition Moderation Add-On for a given target to detect labels in an image.
# @see https://uploadcare.com/api-refs/rest-api/v0.7.0/#tag/Add-Ons/operation/awsRekognitionDetectModerationLabelsExecute
def rekognition_detect_moderation_labels(uuid)
Uploadcare::Addons.ws_rekognition_detect_moderation_labels(uuid)
end

# Check the status of an Add-On execution request that had been started using the Execute Add-On operation.
# @see https://uploadcare.com/api-refs/rest-api/v0.7.0/#tag/Add-Ons/operation/awsRekognitionDetectModerationLabelsExecutionStatus
def rekognition_detect_moderation_labels_status(uuid)
Uploadcare::Addons.ws_rekognition_detect_moderation_labels_status(uuid)
end
end
end
end
Expand Down
18 changes: 9 additions & 9 deletions spec/fixtures/vcr_cassettes/group_api_get_group.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions spec/fixtures/vcr_cassettes/remove_bg.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions spec/fixtures/vcr_cassettes/remove_bg_status.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions spec/fixtures/vcr_cassettes/uc_clamav_virus_scan.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions spec/fixtures/vcr_cassettes/uc_clamav_virus_scan_status.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0659cc0

Please sign in to comment.