transloadit 0.1.0 transloadit: ^0.1.0 copied to clipboard
A Flutter library that provides tooling to interact with the Transloadit API.
Transloadit Flutter SDK #
Flutter integration with Transloadit
WIP - 1.0 Release #
- Create assemblies
- Get assemblies
- Delete assemblies
- Add files
- Remove files
- Replay assemblies
- Retrieve list of assemblies
- Replay assembly notification
- Retrieve list of assembly notifications
- Retrieve month's bill
- Get priority job slots
- Create templates
- Get templates
- Edit templates
- Delete templates
- Run templates
- Error handling
- Better tests
- Add an example file
Basic Examples #
Creating client #
TransloaditClient client = TransloaditClient(
authKey: 'KEY',
authSecret: 'SECRET');
Getting an assembly #
TransloaditResponse response = await client.getAssembly(
assemblyID: 'ASSEMBLY_ID');
print(response.statusCode) // 200
Creating an assembly #
TransloaditAssembly assembly = client.newAssembly();
final imagePath = 'assets/cat.jpg';
assembly.addStep("import", "/http/import",
{"url": "https://demos.transloadit.com/inputs/chameleon.jpg"});
assembly.addStep("resize", "/image/resize", {"height": 400});
TransloaditResponse response = await assembly.createAssembly();
print(response['ok']) // "ASSEMBLY_COMPLETED"
Creating a template #
TransloaditTemplate template = client.newTemplate(name: "template");
template.addStep("import", "/http/import",
{"url": "https://demos.transloadit.com/inputs/chameleon.jpg"});
template.addStep("resize", "/image/resize", {"use": "import", "height": 400});
TransloaditResponse response = await template.createTemplate();
print(response['ok']) // "TEMPLATE_CREATED"
Updating a template #
TransloaditResponse response = await client.updateTemplate(
templateID: 'TEMPLATE_ID',
template: {
"import": {
"robot": "/http/import",
"url": "https://demos.transloadit.com/inputs/chameleon.jpg"
},
"resize": {"use": "import", "robot": "/image/resize", "height": 200}
},
);
print(response['ok']) // "TEMPLATE_UPDATED"
Running template with fields #
TransloaditAssembly assembly = client.runTemplate(
templateID: 'TEMPLATE_ID',
params: {'fields': {'input': 'items.jpg'}});
TransloaditResponse response = await assembly.createAssembly();
print(response.data["ok"]); // "ASSEMBLY_COMPLETED"
Running template with fields #
TransloaditAssembly assembly = client.runTemplate(
templateID: 'TEMPLATE_ID',
params: {'fields': {'input': 'items.jpg'}});
TransloaditResponse response = await assembly.createAssembly();
print(response.data["ok"]); // "ASSEMBLY_COMPLETED"
Tracking upload progress #
TransloaditResponse response = await assembly.createAssembly(
onProgress: (progressValue) {
print(progressValue); // Value from 0-100
},
onComplete: () {
// Do stuff
}),
);