Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OSSClient

Client providing access to Autodesk Forge OSS (object storage service) APIs.

link

https://forge.autodesk.com/en/docs/data/v2

Hierarchy

  • OSSClient

Index

Constructors

constructor

Properties

Protected apiClient

apiClient: ApiClient

Protected auth

Protected authProvider

authProvider: IAuthProvider

Protected bucketsApi

bucketsApi: BucketsApi

Protected host

host: string

Protected objectsApi

objectsApi: ObjectsApi

Protected region

region: Region

Methods

copyObject

  • copyObject(bucketKey: string, oldObjectKey: string, newObjectKey: string): Promise<IObject>

createBucket

createSignedUrl

  • createSignedUrl(bucketKey: string, objectKey: string, access?: "read" | "write" | "readwrite", minutesExpiration?: number): Promise<ISignedUrl>

deleteBucket

  • deleteBucket(bucketKey: string): Promise<void>

deleteObject

  • deleteObject(bucketKey: string, objectKey: string): Promise<void>

downloadObject

  • downloadObject(bucketKey: string, objectKey: string): Promise<Buffer>

enumerateBuckets

  • enumerateBuckets(pageSize?: number): AsyncIterable<IBucket[]>
  • Enumerates all buckets in pages/batches of predefined size.

    link

    https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-GET

    async
    generator
    yields

    {AsyncIterable<IBucket[]>} Bucket batches.

    throws

    Error when the request fails, for example, due to insufficient rights, or incorrect scopes.

    example
    const client = new OSSClient({ client_id: process.env.FORGE_CLIENT_ID, client_secret: process.env.FORGE_CLIENT_SECRET });
    for await (const page of client.enumerateBuckets()) {
        console.log(page.map(bucket => bucket.bucketKey).join(','));
    }
    

    Parameters

    • pageSize: number = ...

    Returns AsyncIterable<IBucket[]>

enumerateObjects

  • enumerateObjects(bucketKey: string, beginsWith?: string, pageSize?: number): AsyncIterable<IObject[]>

getBucketDetails

getObjectDetails

  • getObjectDetails(bucketKey: string, objectKey: string): Promise<IObject>

listBuckets

  • listBuckets(): Promise<IBucket[]>
  • Lists all buckets.

    link

    https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-GET

    async
    throws

    Error when the request fails, for example, due to insufficient rights, or incorrect scopes.

    example
    const client = new OSSClient({ client_id: process.env.FORGE_CLIENT_ID, client_secret: process.env.FORGE_CLIENT_SECRET });
    const buckets = client.listBuckets();
    console.log(buckets.map(bucket => bucket.bucketKey).join(','));
    

    Returns Promise<IBucket[]>

    List of buckets.

listObjects

  • listObjects(bucketKey: string, beginsWith?: string): Promise<IObject[]>

uploadObject

  • uploadObject(bucketKey: string, objectKey: string, data: Buffer): Promise<IObject>

Generated using TypeDoc