Class DataManagementClient

Client providing access to Autodesk Forge management APIs.

Tutorial

data-management

Hierarchy (view full)

Constructors

  • Initializes new client with specific authentication method.

    Parameters

    • auth: IAuthOptions

      Authentication object, containing either client_id and client_secret properties (for 2-legged authentication), or a single token property (for 2-legged or 3-legged authentication with pre-generated access token).

    • Optional host: string

      Forge API host.

    • Optional region: Region

      Forge availability region ("US" or "EMEA").

    Returns DataManagementClient

Properties

axios: AxiosInstance
host: string
region: Region
root: string
token?: string

Methods

  • Parameters

    • endpoint: string

    Returns Promise<any>

  • Parameters

    • endpoint: string
    • limit: number

    Returns AsyncGenerator<any, void, unknown>

  • Finalizes the upload of a file to OSS.

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Object key.

    • uploadKey: string

      Upload key returned by {@see getUploadUrls}.

    • Optional contentType: string

      Optinal content type that should be recorded for the uploaded file.

    Returns Promise<IObject>

    Details of the uploaded object in OSS.

  • Parameters

    • endpoint: string
    • headers: {
          [name: string]: string;
      } = {}
      • [name: string]: string
    • scopes: string[]

    Returns Promise<any>

  • Deletes bucket (this endpoint is not documented on the Forge portal).

    Parameters

    • bucketKey: string

      Bucket key.

    Returns Promise<any>

    Async

    Throws

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

  • Downloads a specific OSS object.

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Object key.

    • Optional options: IDownloadOptions

      Additional download options.

    Returns Promise<ArrayBuffer>

    Object content.

    Async

    Throws

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

  • Downloads content stream of a specific bucket object.

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Object name.

    • Optional options: IDownloadOptions

      Additional download options.

    Returns Promise<ReadableStream<any>>

    Object content stream.

    Async

    Throws

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

  • Parameters

    • config: AxiosRequestConfig<any>

    Returns Promise<AxiosResponse<any, any>>

  • Parameters

    • endpoint: string
    • headers: {
          [name: string]: string;
      } = {}
      • [name: string]: string
    • scopes: string[]

    Returns Promise<any>

  • Parameters

    • endpoint: string
    • headers: {
          [name: string]: string;
      } = {}
      • [name: string]: string
    • scopes: string[]

    Returns Promise<any>

  • Generates a signed URL that can be used to download a file from OSS.

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Object key.

    • useCdn: boolean = true

    Returns Promise<IDownloadParams>

    Download URLs and potentially other helpful information.

  • Parameters

    • endpoint: string
    • headers: {
          [name: string]: string;
      } = {}
      • [name: string]: string
    • scopes: string[]

    Returns Promise<any>

  • Generates one or more signed URLs that can be used to upload a file (or its parts) to OSS, and an upload key that is used to generate additional URLs or in {@see completeUpload} after all the parts have been uploaded successfully.

    The URLs are valid for 60min.

    Note that if you are uploading in multiple parts, each part except for the final one must be of size at least 5MB, otherwise the call to {@see completeUpload} will fail.

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Object key.

    • Optional parts: number = 1

      How many URLs to generate in case of multi-part upload.

    • Optional firstPart: number = 1

      Index of the part the first returned URL should point to. For example, to upload parts 10 through 15 of a file, use firstPart = 10 and parts = 6.

    • Optional uploadKey: string

      Optional upload key if this is a continuation of a previously initiated upload.

    Returns Promise<IUploadParams>

    Signed URLs for uploading chunks of the file to AWS S3 (valid for 60min), and a unique upload key used to generate additional URLs or to complete the upload.

  • Iterates over all objects in a bucket in pages of predefined size (https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-GET|docs).

    Parameters

    • bucket: string

      Bucket key.

    • Optional limit: number = 16

      Max number of objects to receive in one batch (allowed values: 1-100).

    • Optional beginsWith: string

      Optional filter to only return objects whose keys are prefixed with this value.

    Returns AsyncIterable<IObject[]>

    Async

    Generator

    Yields

    List of object containing 'bucketKey', 'objectKey', 'objectId', 'sha1', 'size', and 'location'.

    Throws

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

  • Parameters

    • endpoint: string
    • data: any
    • headers: {
          [name: string]: string;
      } = {}
      • [name: string]: string
    • scopes: string[]

    Returns Promise<any>

  • Parameters

    • endpoint: string
    • data: any
    • headers: {
          [name: string]: string;
      } = {}
      • [name: string]: string
    • scopes: string[]

    Returns Promise<any>

  • Parameters

    • endpoint: string
    • data: any
    • headers: {
          [name: string]: string;
      } = {}
      • [name: string]: string
    • scopes: string[]

    Returns Promise<any>

  • Resets client to specific authentication method, Forge host, and availability region.

    Parameters

    • Optional auth: IAuthOptions

      Authentication object, containing either client_id and client_secret properties (for 2-legged authentication), or a single token property (for 2-legged or 3-legged authentication with pre-generated access token).

    • Optional host: string

      Forge API host.

    • Optional region: Region

      Forge availability region ("US" or "EMEA").

    Returns void

  • Uploads content to a specific bucket object.

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Name of uploaded object.

    • data: Buffer

      Object content.

    • Optional options: IUploadOptions

      Additional upload options.

    Returns Promise<IObject>

    Object description containing 'bucketKey', 'objectKey', 'objectId', 'sha1', 'size', 'location', and 'contentType'.

    Async

    Throws

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

  • Parameters

    • bucketKey: string

      Bucket key.

    • objectName: string

      Name of uploaded object.

    • data: Buffer

      Object content.

    • byteOffset: number

      Byte offset of the uploaded blob in the target object.

    • totalBytes: number

      Total byte size of the target object.

    • sessionId: string

      Resumable session ID.

    • Optional contentType: string = 'application/stream'

      Type of content to be used in HTTP headers, for example, "application/json".

    Returns Promise<any>

    Deprecated

    This method of resumable upload is now deprecated and will be removed in future versions. Use {@see getUploadUrls} and {@see completeUpload} instead.

    Uploads content to a specific bucket object using the resumable capabilities (https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectName-resumable-PUT|docs).

    Async

    Throws

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

  • Uploads content stream to a specific bucket object.

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Name of uploaded object.

    • input: AsyncIterable<Buffer>
    • Optional options: IUploadOptions

      Additional upload options.

    Returns Promise<IObject>

    Object description containing 'bucketKey', 'objectKey', 'objectId', 'sha1', 'size', 'location', and 'contentType'.

    Async

    Throws

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

  • Parameters

    • bucketKey: string

      Bucket key.

    • objectName: string

      Name of uploaded object.

    • stream: ReadableStream<any>

      Object content stream.

    • chunkBytes: number

      Byte size of the stream to be uploaded.

    • byteOffset: number

      Byte offset of the uploaded blob in the target object.

    • totalBytes: number

      Total byte size of the target object.

    • sessionId: string

      Resumable session ID.

    • Optional contentType: string = 'application/stream'

      Type of content to be used in HTTP headers, for example, "application/json".

    Returns Promise<any>

    Deprecated

    This method of resumable upload is now deprecated and will be removed in future versions. Use {@see getUploadUrls} and {@see completeUpload} instead.

    Uploads content stream to a specific bucket object using the resumable capabilities (https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectName-resumable-PUT|docs).

    Async

    Throws

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

Generated using TypeDoc