Fix type definitions for forge-apis (#39160)

* Fix type definitions for forge-apis

* Add `statusBody` to `ApiError`

* Update install instructions

* Update response body types

* Remove comments
This commit is contained in:
Benji Marinacci
2019-10-25 13:24:11 -07:00
committed by Wesley Wigham
parent 86095c295c
commit 88e2d21b96
4 changed files with 1470 additions and 141 deletions
+15 -5
View File
@@ -1,16 +1,26 @@
# Installation
> `npm install --save @types/forge-apis`
```bash
yarn add --dev @types/forge-apis
# or
npm install --save-dev @types/forge-apis
```
# Summary
This package contains type definitions for Forge Node.js SDK (https://github.com/Autodesk-Forge/forge-api-nodejs-client).
This package contains type definitions for the Forge Node.js SDK (https://github.com/Autodesk-Forge/forge-api-nodejs-client).
The corresponding v1/v2 API docs are located here: https://forge.autodesk.com/en/docs/data/v2/reference/http.
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/forge-apis
Additional Details
* Last updated: Fri, 11 Jan 2019 10:39:13 GMT
* Dependencies: @types/three
* Global values: none
- Last updated: Tue, 15 Oct 2019 23:59:13 UTC
- Dependencies: @types/node
- Global values: none
# Credits
<a href="mailto:forge.help@autodesk.com">Forge Partner Development</a>
+326 -7
View File
@@ -1,13 +1,332 @@
import { AuthClientTwoLegged, AuthClientThreeLegged, BucketsApi, HubsApi, FoldersApi, DerivativesApi } from 'forge-apis';
import {
AuthToken,
AuthClientTwoLegged,
AuthClientThreeLegged,
ActivitiesApi,
AppPackagesApi,
BucketsApi,
DerivativesApi,
EnginesApi,
FoldersApi,
HubsApi,
ItemsApi,
ObjectsApi,
ProjectsApi,
UserProfileApi,
VersionsApi,
WorkItemsApi,
} from 'forge-apis';
const authClientTwoLegged: AuthClientTwoLegged = new AuthClientTwoLegged("", "", []);
const authToken: AuthToken = {
access_token: '',
expires_in: 0,
token_type: '',
refresh_token: '',
};
const authClientThreeLegged: AuthClientThreeLegged = new AuthClientThreeLegged("", "", "", []);
// $ExpectType AuthClientTwoLegged
const authClientTwoLegged = new AuthClientTwoLegged('', '', [], true);
// $ExpectType Promise<AuthToken>
authClientTwoLegged.authenticate();
// $ExpectType AuthToken
authClientTwoLegged.getCredentials();
// $ExpectType void
authClientTwoLegged.setCredentials(authToken);
// $ExpectType boolean
authClientTwoLegged.isAuthorized();
const bucketsApi: BucketsApi = new BucketsApi();
// $ExpectType AuthClientThreeLegged
const authClientThreeLegged = new AuthClientThreeLegged('', '', '', [], true);
// $ExpectType string
authClientThreeLegged.generateAuthUrl();
// $ExpectType Promise<AuthToken>
authClientThreeLegged.getToken('');
// $ExpectType Promise<AuthToken>
authClientThreeLegged.refreshToken(authToken);
const hubsApi: HubsApi = new HubsApi();
// $ExpectType ActivitiesApi
const activitiesApi = new ActivitiesApi();
const foldersApi: FoldersApi = new FoldersApi();
// $ExpectType Promise<ApiResponse>
activitiesApi.createActivity(
{
id: '',
instruction: {},
appPackages: [''],
requiredEngineVersion: '',
parameters: {},
allowedChildProcesses: [{}],
version: 0,
description: '',
hostApplication: '',
isPublic: true,
},
authClientTwoLegged,
authToken,
);
// $ExpectType Promise<ApiResponse>
activitiesApi.deleteActivity('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
activitiesApi.deleteActivityHistory('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
activitiesApi.getActivity('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
activitiesApi.getActivityVersions('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
activitiesApi.getAllActivities(authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
activitiesApi.patchActivity('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
activitiesApi.setActivityVersion('', {}, authClientTwoLegged, authToken);
const derivativesApi: DerivativesApi = new DerivativesApi();
// $ExpectType AppPackagesApi
const appPackagesApi = new AppPackagesApi();
// $ExpectType Promise<ApiResponse>
appPackagesApi.createAppPackage(
{
id: '',
resource: '',
references: [''],
requiredEngineVersion: '',
version: 0,
description: '',
isPublic: true,
isObjectEnabler: true,
},
authClientTwoLegged,
authToken,
);
// $ExpectType Promise<ApiResponse>
appPackagesApi.deleteAppPackage('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
appPackagesApi.deleteAppPackageHistory('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
appPackagesApi.getAllAppPackages(authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
appPackagesApi.getAppPackage('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
appPackagesApi.getAppPackageVersions('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
appPackagesApi.getUploadUrl(authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
appPackagesApi.getUploadUrlWithRequireContentType(true, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
appPackagesApi.patchAppPackage('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
appPackagesApi.setAppPackageVersion('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
appPackagesApi.updateAppPackage(
'',
{
id: '',
resource: '',
references: [''],
requiredEngineVersion: '',
version: 0,
description: '',
isPublic: true,
isObjectEnabler: true,
},
authClientTwoLegged,
authToken,
);
// $ExpectType BucketsApi
const bucketsApi = new BucketsApi();
// $ExpectType Promise<ApiResponse>
bucketsApi.createBucket(
{
bucketKey: '',
policyKey: 'transient',
},
{},
authClientTwoLegged,
authToken,
);
// $ExpectType Promise<ApiResponse>
bucketsApi.deleteBucket('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
bucketsApi.getBucketDetails('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
bucketsApi.getBuckets({}, authClientTwoLegged, authToken);
// $ExpectType DerivativesApi
const derivativesApi = new DerivativesApi();
// $ExpectType Promise<ApiResponse>
derivativesApi.deleteManifest('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
derivativesApi.getDerivativeManifest('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
derivativesApi.getFormats({}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
derivativesApi.getManifest('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
derivativesApi.getMetadata('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
derivativesApi.getModelviewMetadata('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
derivativesApi.getModelviewProperties('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
derivativesApi.getThumbnail('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
derivativesApi.translate(
{
input: {
urn: '',
compressedUrn: true,
rootFilename: '',
},
output: {
formats: [
{
type: 'svf',
views: ['2d'],
advanced: {
exportFileStructure: 'single',
modelGuid: '',
objectIds: [''],
},
},
],
},
},
{},
authClientTwoLegged,
authToken,
);
// $ExpectType EnginesApi
const enginesApi = new EnginesApi();
// $ExpectType Promise<ApiResponse>
enginesApi.getAllEngines(authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
enginesApi.getEngine('', authClientTwoLegged, authToken);
// $ExpectType FoldersApi
const foldersApi = new FoldersApi();
// $ExpectType Promise<ApiResponse>
foldersApi.getFolder('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
foldersApi.getFolderContents('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
foldersApi.getFolderParent('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
foldersApi.getFolderRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
foldersApi.getFolderRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
foldersApi.postFolder('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
foldersApi.postFolderRelationshipsRef('', '', {}, authClientTwoLegged, authToken);
// $ExpectType HubsApi
const hubsApi = new HubsApi();
// $ExpectType Promise<ApiResponse>
hubsApi.getHub('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
hubsApi.getHubs({}, authClientTwoLegged, authToken);
// $ExpectType ItemsApi
const itemsApi = new ItemsApi();
// $ExpectType Promise<ApiResponse>
itemsApi.getItem('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
itemsApi.getItemParentFolder('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
itemsApi.getItemRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
itemsApi.getItemRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
itemsApi.getItemTip('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
itemsApi.getItemVersions('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
itemsApi.postItem('', { included: [{ type: '', id: '' }] }, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
itemsApi.postItemRelationshipsRef('', '', {}, authClientTwoLegged, authToken);
// $ExpectType ObjectsApi
const objectsApi = new ObjectsApi();
// $ExpectType Promise<ApiResponse>
objectsApi.copyTo('', '', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.createSignedResource('', '', { minutesExpiration: 0 }, '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.deleteObject('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.deleteSignedResource('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.getObjectDetails('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.getObjects('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.getSignedResource('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.getStatusBySessionId('', '', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.uploadChunk('', '', 0, '', '', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.uploadObject('', '', 0, '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.uploadSignedResource('', 0, '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
objectsApi.uploadSignedResourcesChunk('', 0, '', '', {}, authClientTwoLegged, authToken);
// $ExpectType ProjectsApi
const projectsApi = new ProjectsApi();
// $ExpectType Promise<ApiResponse>
projectsApi.getHubProjects('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
projectsApi.getProject('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
projectsApi.getProjectHub('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
projectsApi.getProjectTopFolders('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
projectsApi.postStorage('', {}, authClientTwoLegged, authToken);
// $ExpectType UserProfileApi
const userProfileApi = new UserProfileApi();
// $ExpectType Promise<ApiResponse>
userProfileApi.getUserProfile(authClientTwoLegged, authToken);
// $ExpectType VersionsApi
const versionsApi = new VersionsApi();
// $ExpectType Promise<ApiResponse>
versionsApi.getVersion('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
versionsApi.getVersionItem('', '', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
versionsApi.getVersionRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
versionsApi.getVersionRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
versionsApi.postVersion('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
versionsApi.postVersion('', {}, authClientTwoLegged, authToken);
// $ExpectType WorkItemsApi
const workItemsApi = new WorkItemsApi();
// $ExpectType Promise<ApiResponse>
workItemsApi.createWorkItem(
{
id: '',
_arguments: {},
status: '',
statusDetail: {},
availabilityZone: '',
activityId: '',
version: 0,
timestamp: '',
},
authClientTwoLegged,
authToken,
);
// $ExpectType Promise<ApiResponse>
workItemsApi.deleteWorkItem('', authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
workItemsApi.getAllWorkItems(0, authClientTwoLegged, authToken);
// $ExpectType Promise<ApiResponse>
workItemsApi.getWorkItem('', authClientTwoLegged, authToken);
+1126 -126
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -2,8 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
@@ -15,7 +14,8 @@
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
"target": "es6"
},
"files": [
"index.d.ts",