-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPresets.java
More file actions
37 lines (31 loc) · 1.13 KB
/
Copy pathPresets.java
File metadata and controls
37 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import com.api2convert.Api2Convert;
import com.api2convert.http.Config;
import com.api2convert.model.Preset;
import java.util.List;
/**
* Guide: Presets — list saved conversion presets (reusable target + options).
*
* <p>Run (SDK + Jackson on the classpath):
* <pre>
* API2CONVERT_API_KEY=your-key java -cp "target/classes:libs/*" Presets
* </pre>
*/
public final class Presets {
public static void main(String[] args) {
Api2Convert client = newClient();
// All presets for the video->mp4 conversion (may be empty if you have saved none).
List<Preset> presets = client.presets().list("video", "mp4", null);
System.out.println("Presets: " + presets.size());
for (Preset preset : presets) {
System.out.println("- " + preset.name() + " -> " + preset.target());
}
}
private static Api2Convert newClient() {
String base = System.getenv("API2CONVERT_BASE_URL");
return base != null && !base.isEmpty()
? new Api2Convert("", Config.builder().baseUrl(base).build())
: new Api2Convert("");
}
private Presets() {
}
}