-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·60 lines (49 loc) · 1.68 KB
/
index.php
File metadata and controls
executable file
·60 lines (49 loc) · 1.68 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
session_start();
include_once "./vendor/autoload.php";
include_once "./server/oauthtoken.php";
include_once "./server/modelderivative.php";
include_once "./server/oss.php";
include_once "./server/config.php";
include_once "./server/oauth.php";
use Klein\Klein;
use Autodesk\ForgeServices\AccessToken;
use Autodesk\ForgeServices\ModelDerivative;
use Autodesk\ForgeServices\DataManagement;
$klein = new Klein();
// Get the access token
$klein->respond('GET', '/api/forge/oauth/token', function () {
$accessToken = new AccessToken();
return $accessToken->getAccessToken();
});
// Get all the buckets & objects
$klein->respond('GET', '/api/forge/oss/buckets', function () {
$dataManagement = new DataManagement();
return $dataManagement->getBucketsAndObjects();
});
// Create a new bucket
$klein->respond('POST', '/api/forge/oss/buckets', function(){
$dataManagement = new DataManagement();
return $dataManagement->createOneBucket();
});
// Upload a file to a bucket
$klein->respond('POST', '/api/forge/oss/objects', function () {
$dataManagement = new DataManagement();
return $dataManagement->uploadFile();
});
// Download svf package
$klein->respond('POST', '/api/forge/oss/svf', function () {
$dataManagement = new DataManagement();
return $dataManagement->downloadSVF();
});
// Start translate the model
$klein->respond('POST', '/api/forge/modelderivative/jobs', function () {
$modelDerivative = new ModelDerivative();
return $modelDerivative->translateFile();
});
// Redirect the homepage to www/index.html
$klein->respond('GET', '/', function ($request, $response, $service) {
$service->render('www/index.html');
return;
});
$klein->dispatch();