How to use forge-apis - 10 common examples

To help you get started, we’ve selected a few forge-apis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / forge-apis / forge-apis-tests.ts View on Github external
// $ExpectType Promise
foldersApi.getFolderRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
foldersApi.postFolder('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
foldersApi.postFolderRelationshipsRef('', '', {}, authClientTwoLegged, authToken);

// $ExpectType HubsApi
const hubsApi = new HubsApi();
// $ExpectType Promise
hubsApi.getHub('', authClientTwoLegged, authToken);
// $ExpectType Promise
hubsApi.getHubs({}, authClientTwoLegged, authToken);

// $ExpectType ItemsApi
const itemsApi = new ItemsApi();
// $ExpectType Promise
itemsApi.getItem('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemParentFolder('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemTip('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemVersions('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.postItem('', { included: [{ type: '', id: '' }] }, authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.postItemRelationshipsRef('', '', {}, authClientTwoLegged, authToken);
github DefinitelyTyped / DefinitelyTyped / types / forge-apis / forge-apis-tests.ts View on Github external
itemsApi.getItemParentFolder('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemTip('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemVersions('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.postItem('', { included: [{ type: '', id: '' }] }, authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.postItemRelationshipsRef('', '', {}, authClientTwoLegged, authToken);

// $ExpectType ObjectsApi
const objectsApi = new ObjectsApi();
// $ExpectType Promise
objectsApi.copyTo('', '', '', authClientTwoLegged, authToken);
// $ExpectType Promise
objectsApi.createSignedResource('', '', { minutesExpiration: 0 }, {}, authClientTwoLegged, authToken);
// $ExpectType Promise
objectsApi.deleteObject('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
objectsApi.deleteSignedResource('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
objectsApi.getObjectDetails('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
objectsApi.getObject('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
objectsApi.getObjects('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
objectsApi.getSignedResource('', {}, authClientTwoLegged, authToken);
github DefinitelyTyped / DefinitelyTyped / types / forge-apis / forge-apis-tests.ts View on Github external
ObjectsApi,
    ProjectsApi,
    UserProfileApi,
    VersionsApi,
    WorkItemsApi,
} from 'forge-apis';

const authToken: AuthToken = {
    access_token: '',
    expires_in: 0,
    token_type: '',
    refresh_token: '',
};

// $ExpectType AuthClientTwoLegged
const authClientTwoLegged = new AuthClientTwoLegged('', '', [], true);
// $ExpectType Promise
authClientTwoLegged.authenticate();
// $ExpectType AuthToken
authClientTwoLegged.getCredentials();
// $ExpectType void
authClientTwoLegged.setCredentials(authToken);
// $ExpectType boolean
authClientTwoLegged.isAuthorized();

// $ExpectType AuthClientThreeLegged
const authClientThreeLegged = new AuthClientThreeLegged('', '', '', [], true);
// $ExpectType string
authClientThreeLegged.generateAuthUrl();
// $ExpectType Promise
authClientThreeLegged.getToken('');
// $ExpectType Promise
github DefinitelyTyped / DefinitelyTyped / types / forge-apis / forge-apis-tests.ts View on Github external
{
        id: '',
        resource: '',
        references: [''],
        requiredEngineVersion: '',
        version: 0,
        description: '',
        isPublic: true,
        isObjectEnabler: true,
    },
    authClientTwoLegged,
    authToken,
);

// $ExpectType BucketsApi
const bucketsApi = new BucketsApi();

// $ExpectType Promise
bucketsApi.createBucket(
    {
        bucketKey: '',
        policyKey: 'transient',
    },
    {},
    authClientTwoLegged,
    authToken,
);
// $ExpectType Promise
bucketsApi.deleteBucket('', authClientTwoLegged, authToken);
// $ExpectType Promise
bucketsApi.getBucketDetails('', authClientTwoLegged, authToken);
// $ExpectType Promise
github DefinitelyTyped / DefinitelyTyped / types / forge-apis / forge-apis-tests.ts View on Github external
foldersApi.getFolder('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
foldersApi.getFolderContents('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
foldersApi.getFolderParent('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
foldersApi.getFolderRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
foldersApi.getFolderRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
foldersApi.postFolder('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
foldersApi.postFolderRelationshipsRef('', '', {}, authClientTwoLegged, authToken);

// $ExpectType HubsApi
const hubsApi = new HubsApi();
// $ExpectType Promise
hubsApi.getHub('', authClientTwoLegged, authToken);
// $ExpectType Promise
hubsApi.getHubs({}, authClientTwoLegged, authToken);

// $ExpectType ItemsApi
const itemsApi = new ItemsApi();
// $ExpectType Promise
itemsApi.getItem('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemParentFolder('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
itemsApi.getItemRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
github DefinitelyTyped / DefinitelyTyped / types / forge-apis / forge-apis-tests.ts View on Github external
// $ExpectType Promise
projectsApi.getProject('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.getProjectHub('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.getProjectTopFolders('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.postStorage('', {}, authClientTwoLegged, authToken);

// $ExpectType UserProfileApi
const userProfileApi = new UserProfileApi();
// $ExpectType Promise
userProfileApi.getUserProfile(authClientTwoLegged, authToken);

// $ExpectType VersionsApi
const versionsApi = new VersionsApi();
// $ExpectType Promise
versionsApi.getVersion('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.getVersionItem('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.getVersionRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.getVersionRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.postVersion('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.postVersion('', {}, authClientTwoLegged, authToken);

// $ExpectType WorkItemsApi
const workItemsApi = new WorkItemsApi();
// $ExpectType Promise
github DefinitelyTyped / DefinitelyTyped / types / forge-apis / forge-apis-tests.ts View on Github external
// $ExpectType ProjectsApi
const projectsApi = new ProjectsApi();
// $ExpectType Promise
projectsApi.getHubProjects('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.getProject('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.getProjectHub('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.getProjectTopFolders('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.postStorage('', {}, authClientTwoLegged, authToken);

// $ExpectType UserProfileApi
const userProfileApi = new UserProfileApi();
// $ExpectType Promise
userProfileApi.getUserProfile(authClientTwoLegged, authToken);

// $ExpectType VersionsApi
const versionsApi = new VersionsApi();
// $ExpectType Promise
versionsApi.getVersion('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.getVersionItem('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.getVersionRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.getVersionRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.postVersion('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
github DefinitelyTyped / DefinitelyTyped / types / forge-apis / forge-apis-tests.ts View on Github external
// $ExpectType void
authClientTwoLegged.setCredentials(authToken);
// $ExpectType boolean
authClientTwoLegged.isAuthorized();

// $ExpectType AuthClientThreeLegged
const authClientThreeLegged = new AuthClientThreeLegged('', '', '', [], true);
// $ExpectType string
authClientThreeLegged.generateAuthUrl();
// $ExpectType Promise
authClientThreeLegged.getToken('');
// $ExpectType Promise
authClientThreeLegged.refreshToken(authToken);

// $ExpectType ActivitiesApi
const activitiesApi = new ActivitiesApi();

// $ExpectType Promise
activitiesApi.createActivity(
    {
        Id: '',
        Instruction: {},
        AppPackages: [''],
        RequiredEngineVersion: '',
        Parameters: {},
        AllowedChildProcesses: [{}],
        Version: 0,
        Description: '',
        HostApplication: '',
        IsPublic: true,
    },
    authClientTwoLegged,
github DefinitelyTyped / DefinitelyTyped / types / forge-apis / forge-apis-tests.ts View on Github external
activitiesApi.deleteActivity('', authClientTwoLegged, authToken);
// $ExpectType Promise
activitiesApi.deleteActivityHistory('', authClientTwoLegged, authToken);
// $ExpectType Promise
activitiesApi.getActivity('', authClientTwoLegged, authToken);
// $ExpectType Promise
activitiesApi.getActivityVersions('', authClientTwoLegged, authToken);
// $ExpectType Promise
activitiesApi.getAllActivities(authClientTwoLegged, authToken);
// $ExpectType Promise
activitiesApi.patchActivity('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
activitiesApi.setActivityVersion('', {}, authClientTwoLegged, authToken);

// $ExpectType AppPackagesApi
const appPackagesApi = new AppPackagesApi();

// $ExpectType Promise
appPackagesApi.createAppPackage(
    {
        id: '',
        resource: '',
        references: [''],
        requiredEngineVersion: '',
        version: 0,
        description: '',
        isPublic: true,
        isObjectEnabler: true,
    },
    authClientTwoLegged,
    authToken,
);
github Autodesk-Forge / forge-upgradefiles-revit / routes / common / da4revitImp.js View on Github external
async function getNewCreatedStorageInfo(projectId, folderId, fileName, oauth_client, oauth_token) {

    // create body for Post Storage request
    let createStorageBody = createBodyOfPostStorage(folderId, fileName);

    const project = new ProjectsApi();
    let storage = await project.postStorage(projectId, createStorageBody, oauth_client, oauth_token);
    if (storage === null || storage.statusCode !== 201) {
        console.log('failed to create a storage.');
        return null;
    }

    // setup the url of the new storage
    const strList = storage.body.data.id.split('/');
    if (strList.length !== 2) {
        console.log('storage id is not correct');
        return null;
    }
    const storageUrl = "https://developer.api.autodesk.com/oss/v2/buckets/" + AUTODESK_HUB_BUCKET_KEY + "/objects/" + strList[1];
    return {
        "StorageId": storage.body.data.id,
        "StorageUrl": storageUrl