Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add latest add-ons #97

Merged
merged 4 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
- Added support for converting multipage into a group of files.
- Added `default_effects` field in `UploadcareFile`.
- Added react to request throttling (429 code response).
- Added support for [object recognition](https://uploadcare.com/docs/intelligence/object-recognition/),
[unsafe content detection](https://uploadcare.com/docs/unsafe-content/),
[malware protection](https://uploadcare.com/docs/security/malware-protection/),
and [background removal](https://uploadcare.com/docs/remove-bg/).
- Fixed authorization signature for requests with url parameters.
- Widget:
- SocialApi doesn't use `GET /sources` method anymore.
- Project:
Expand Down
325 changes: 325 additions & 0 deletions documentation/LIBRARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -1251,3 +1251,328 @@ List<String> fileIds = ... // list of file UUID's

UploadcareGroup uploadcareGroup = uploadcare.createGroup(fileIds, null);
```

## Execute AWS Rekognition ([API Reference](https://uploadcare.com/api-refs/rest-api/v0.7.0/#tag/Add-Ons/operation/awsRekognitionExecute)) ##

##### Asynchronous AWS Rekognition execute.

Kotlin
```kotlin
// Create AWS Rekognition Add-On
val addOn = AWSRekognitionAddOn(uploadcare)

// Execute
addOn.executeAsync("YOUR_FILE_UUID", object : UploadcareFileCallback {
override fun onFailure(e: UploadcareApiException) {
// Handle errors.
}

override fun onSuccess(result: UploadcareFile) {
// Successfully execute Add-On.
}
})
```

Java
CheK539 marked this conversation as resolved.
Show resolved Hide resolved
```java
// Create AWS Rekognition Add-On
AWSRekognitionAddOn addOn = new AWSRekognitionAddOn(uploadcare);

// Execute
addOn.executeAsync(
"YOUR_FILE_UUID",
new UploadcareFileCallback() {
@Override
public void onFailure(@NotNull UploadcareApiException e) {
// Handle errors.
}

@Override
public void onSuccess(@NonNull UploadcareFile result) {
// Successfully execute Add-On.
}
});
```

##### Synchronous AWS Rekognition execute.

Kotlin
```kotlin
// Create AWS Rekognition Add-On
val addOn = AWSRekognitionAddOn(uploadcare)

// Execute
val executeResult = addOn.execute("YOUR_FILE_UUID")

// Check status
val statusResult = addOn.check(executeResult.requestId)

if (statusResult.status == AddOnStatus.DONE) {
// Get file with appdata field
uploadcare.getFileWithAppData("YOUR_FILE_UUID")
} else {
// Handle other statuses
}
```

Java
CheK539 marked this conversation as resolved.
Show resolved Hide resolved
```java
// Create AWS Rekognition Add-On
AWSRekognitionAddOn addOn = new AWSRekognitionAddOn(uploadcare);

// Execute
AddOnExecuteResult executeResult = addOn.execute("YOUR_FILE_UUID");

// Check status
AddOnStatusResult statusResult = addOn.check(executeResult.getRequestId());

if (statusResult.getStatus() == AddOnStatus.DONE) {
// Get file with appdata field
uploadcare.getFileWithAppData("YOUR_FILE_UUID");
} else {
// Handle other statuses
}
```

## Execute AWS Rekognition Moderation ([API Reference](https://uploadcare.com/api-refs/rest-api/v0.7.0/#tag/Add-Ons/operation/awsRekognitionDetectModerationLabelsExecute)) ##

##### Asynchronous AWS Rekognition Moderation execute.

Kotlin
```kotlin
// Create AWS Rekognition Add-On
val addOn = AWSRekognitionModerationAddOn(uploadcare)

// Execute
addOn.executeAsync(object : UploadcareFileCallback {
override fun onFailure(e: UploadcareApiException) {
// Handle errors.
}

override fun onSuccess(result: UploadcareFile) {
// Successfully execute Add-On.
}
})
```

Java
CheK539 marked this conversation as resolved.
Show resolved Hide resolved
```java
// Create AWS Rekognition Add-On
AWSRekognitionModerationAddOn addOn = new AWSRekognitionModerationAddOn(uploadcare);

// Execute
addOn.executeAsync(
new UploadcareFileCallback() {
@Override
public void onFailure(@NotNull UploadcareApiException e) {
// Handle errors.
}

@Override
public void onSuccess(@NonNull UploadcareFile result) {
// Successfully execute Add-On.
}
});
```

##### Synchronous AWS Rekognition Moderation execute.

Kotlin
```kotlin
// Create AWS Rekognition Moderation Add-On
val addOn = AWSRekognitionModerationAddOn(uploadcare)

// Execute
val executeResult = addOn.execute("YOUR_FILE_UUID")

// Check status
val statusResult = addOn.check(executeResult.requestId)

if (statusResult.status == AddOnStatus.DONE) {
// Get file with appdata field
uploadcare.getFileWithAppData("YOUR_FILE_UUID")
} else {
// Handle other statuses
}
```

Java
CheK539 marked this conversation as resolved.
Show resolved Hide resolved
```java
// Create AWS Rekognition Moderation Add-On
AWSRekognitionModerationAddOn addOn = new AWSRekognitionModerationAddOn(uploadcare);

// Execute
AddOnExecuteResult executeResult = addOn.execute("YOUR_FILE_UUID");

// Check status
AddOnStatusResult statusResult = addOn.check(executeResult.getRequestId());

if (statusResult.getStatus() == AddOnStatus.DONE) {
// Get file with appdata field
uploadcare.getFileWithAppData("YOUR_FILE_UUID");
} else {
// Handle other statuses
}
```

## Execute ClamAV ([API Reference](https://uploadcare.com/api-refs/rest-api/v0.7.0/#tag/Add-Ons/operation/ucClamavVirusScanExecute)) ##

##### Asynchronous ClamAV execute.

Kotlin
```kotlin
// Create ClamAV Add-On
val addOn = ClamAVAddOn(uploadcare)

// Execute
addOn.executeAsync(object : UploadcareFileCallback {
override fun onFailure(e: UploadcareApiException) {
// Handle errors.
}

override fun onSuccess(result: UploadcareFile) {
// Successfully execute Add-On.
}
})
```

Java
CheK539 marked this conversation as resolved.
Show resolved Hide resolved
```java
// Create ClamAV Add-On
ClamAVAddOn addOn = new ClamAVAddOn(uploadcare);

// Execute
addOn.executeAsync(
new UploadcareFileCallback() {
@Override
public void onFailure(@NotNull UploadcareApiException e) {
// Handle errors.
}

@Override
public void onSuccess(@NonNull UploadcareFile result) {
// Successfully execute Add-On.
}
});
```

##### Synchronous ClamAV execute.

Kotlin
```kotlin
// Create ClamAV Add-On
val addOn = ClamAVAddOn(uploadcare)

// Execute
val executeResult = addOn.execute("YOUR_FILE_UUID")

// Check status
val statusResult = addOn.check(executeResult.requestId)

if (statusResult.status == AddOnStatus.DONE) {
// Get file with appdata field
uploadcare.getFileWithAppData("YOUR_FILE_UUID")
} else {
// Handle other statuses
}
```

Java
CheK539 marked this conversation as resolved.
Show resolved Hide resolved
```java
// Create ClamAV Add-On
ClamAVAddOn addOn = new ClamAVAddOn(uploadcare);

// Execute
AddOnExecuteResult executeResult = addOn.execute("YOUR_FILE_UUID");

// Check status
AddOnStatusResult statusResult = addOn.check(executeResult.getRequestId());

if (statusResult.getStatus() == AddOnStatus.DONE) {
// Get file with appdata field
uploadcare.getFileWithAppData("YOUR_FILE_UUID")
} else {
// Handle other statuses
}
```

## Execute Remove.bg ([API Reference](https://uploadcare.com/api-refs/rest-api/v0.7.0/#tag/Add-Ons/operation/removeBgExecute)) ##

##### Asynchronous Remove.bg execute.

Kotlin
```kotlin
// Create Remove.bg Add-On
val addOn = RemoveBgAddOn(uploadcare)

// Execute
addOn.executeAsync(object : UploadcareFileCallback {
override fun onFailure(e: UploadcareApiException) {
// Handle errors.
}

override fun onSuccess(result: UploadcareFile) {
// Successfully execute Add-On.
}
})
```

Java
CheK539 marked this conversation as resolved.
Show resolved Hide resolved
```java
// Create Remove.bg Add-On
RemoveBgAddOn addOn = new RemoveBgAddOn(uploadcare);

// Execute
addOn.executeAsync(
new UploadcareFileCallback() {
@Override
public void onFailure(@NotNull UploadcareApiException e) {
// Handle errors.
}

@Override
public void onSuccess(@NonNull UploadcareFile result) {
// Successfully execute Add-On.
}
});
```

##### Synchronous Remove.bg execute.

Kotlin
```kotlin
// Create Remove.bg Add-On
val addOn = RemoveBgAddOn(uploadcare)

// Execute
val executeResult = addOn.execute("YOUR_FILE_UUID")

// Check status
val statusResult = addOn.check(executeResult.requestId)

if (statusResult.status == AddOnStatus.DONE) {
// Get file with appdata field
statusResult.result?.let { uploadcare.getFile(it.fileId) }
} else {
// Handle other statuses
}
```

Java
CheK539 marked this conversation as resolved.
Show resolved Hide resolved
```java
// Create Remove.bg Add-On
RemoveBgAddOn addOn = new RemoveBgAddOn(uploadcare);

// Execute
AddOnExecuteResult executeResult = addOn.execute("YOUR_FILE_UUID");

// Check status
AddOnStatusResult statusResult = addOn.check(executeResult.getRequestId());

if (statusResult.getStatus() == AddOnStatus.DONE && statusResult.getResult() != null) {
// Get file with appdata field
uploadcare.getFile(statusResult.getResult().getFileId());
} else {
// Handle other statuses
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,22 @@ class CdnFragment : Fragment(), MenuProvider {
viewModel.convertVideo()
true
}
R.id.action_execute_aws_rekognition -> {
viewModel.executeAWSRekognitionAddOn()
true
}
R.id.action_execute_aws_rekognition_moderation -> {
viewModel.executeAWSRekognitionModerationAddOn()
true
}
R.id.action_execute_clam_av -> {
viewModel.executeClamAVAddOn()
true
}
R.id.action_execute_remove_bg -> {
viewModel.executeRemoveBgAddOn()
true
}
else -> false
}

Expand Down
Loading