Options
All
  • Public
  • Public/Protected
  • All
Menu

Client providing access to APS Data Management API (https://aps.autodesk.com/en/docs/data/v2/reference/http/).

tutorial

data-management

Hierarchy

Index

Constructors

constructor

  • 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
    • Optional region: US | EMEA

    Returns DataManagementClient

Properties

Protected Optional auth

Protected axios

axios: AxiosInstance

Protected host

host: string

Protected region

region: Region

Protected root

root: string

Protected Optional token

token: string

Methods

Private _collect

  • _collect(endpoint: string): Promise<any>

Private _pager

  • _pager(endpoint: string, limit: number): AsyncGenerator<any, void, unknown>
  • Parameters

    • endpoint: string
    • limit: number

    Returns AsyncGenerator<any, void, unknown>

completeUpload

  • completeUpload(bucketKey: string, objectKey: string, uploadKey: string, contentType?: string): Promise<IObject>
  • 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

    Returns Promise<IObject>

    Details of the uploaded object in OSS.

copyObject

  • copyObject(bucket: string, oldObjectKey: string, newObjectKey: string): Promise<IObject>
  • Makes a copy of object under another name within the same bucket (docs).

    async
    throws

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

    Parameters

    • bucket: string

      Bucket key.

    • oldObjectKey: string

      Original object key.

    • newObjectKey: string

      New object key.

    Returns Promise<IObject>

    Details of the new object copy.

createBucket

  • Creates a new bucket (docs).

    async
    throws

    Error when the request fails, for example, due to insufficient rights, incorrect scopes, or when a bucket with this name already exists.

    Parameters

    • bucket: string

      Bucket key.

    • dataRetention: DataRetentionPolicy

      Data retention policy for objects uploaded to this bucket.

    Returns Promise<IBucketDetail>

    Bucket details, with properties "bucketKey", "bucketOwner", "createdDate", "permissions", and "policyKey".

createSignedUrl

  • createSignedUrl(bucketId: string, objectId: string, access?: string, useCdn?: boolean): Promise<ISignedUrl>
  • Creates signed URL for specific object (docs).

    async
    throws

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

    Parameters

    • bucketId: string

      Bucket key.

    • objectId: string

      Object key.

    • access: string = 'readwrite'
    • useCdn: boolean = true

    Returns Promise<ISignedUrl>

    Description of the new signed URL resource.

Protected delete

  • delete(endpoint: string, headers?: {}, scopes: string[]): Promise<any>
  • Parameters

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

    Returns Promise<any>

deleteBucket

  • deleteBucket(bucketKey: string): Promise<any>
  • Deletes bucket.

    async
    throws

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

    Parameters

    • bucketKey: string

      Bucket key.

    Returns Promise<any>

deleteObject

  • deleteObject(bucketKey: string, objectName: string): Promise<any>
  • Deletes object (docs).

    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 object to delete.

    Returns Promise<any>

downloadObject

  • downloadObject(bucketKey: string, objectKey: string, options?: IDownloadOptions): Promise<ArrayBuffer>
  • Downloads a specific OSS object.

    async
    throws

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

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Object key.

    • Optional options: IDownloadOptions

    Returns Promise<ArrayBuffer>

    Object content.

downloadObjectStream

  • downloadObjectStream(bucketKey: string, objectKey: string, options?: IDownloadOptions): Promise<ReadableStream<any>>
  • Downloads content stream of a specific bucket object.

    async
    throws

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

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Object name.

    • Optional options: IDownloadOptions

    Returns Promise<ReadableStream<any>>

    Object content stream.

Protected fetch

  • fetch(config: AxiosRequestConfig): Promise<AxiosResponse<any>>

Protected get

  • get(endpoint: string, headers?: {}, scopes: string[]): Promise<any>
  • Parameters

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

    Returns Promise<any>

getBucketDetails

  • Gets details of a specific bucket (docs).

    async
    throws

    Error when the request fails, for example, due to insufficient rights, or when a bucket with this name does not exist.

    Parameters

    • bucket: string

      Bucket key.

    Returns Promise<IBucketDetail>

    Bucket details, with properties "bucketKey", "bucketOwner", "createdDate", "permissions", and "policyKey".

Protected getBuffer

  • getBuffer(endpoint: string, headers?: {}, scopes: string[]): Promise<any>
  • Parameters

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

    Returns Promise<any>

getDownloadUrl

  • getDownloadUrl(bucketKey: string, objectKey: string, useCdn?: boolean): Promise<IDownloadParams>
  • 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.

getObjectDetails

  • getObjectDetails(bucket: string, object: string): Promise<IObject>
  • Gets details of a specific bucket object (docs).

    async
    throws

    Error when the request fails, for example, due to insufficient rights, or when an object with this name does not exist.

    Parameters

    • bucket: string

      Bucket key.

    • object: string

      Object name.

    Returns Promise<IObject>

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

getResumableUploadStatus

  • getResumableUploadStatus(bucketKey: string, objectName: string, sessionId: string): Promise<IResumableUploadRange[]>
  • deprecated

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

    Gets status of a resumable upload session (docs).

    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.

    • sessionId: string

      Resumable session ID.

    Returns Promise<IResumableUploadRange[]>

    List of range objects, with each object specifying 'start' and 'end' byte offsets of data that has already been uploaded.

Protected getStream

  • getStream(endpoint: string, headers?: {}, scopes: string[]): Promise<any>
  • Parameters

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

    Returns Promise<any>

getUploadUrls

  • getUploadUrls(bucketKey: string, objectKey: string, parts?: number, firstPart?: number, uploadKey?: string): Promise<IUploadParams>
  • 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.

    • parts: number = 1
    • firstPart: number = 1
    • Optional uploadKey: string

    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.

iterateBuckets

  • iterateBuckets(limit?: number): AsyncIterable<IBucket[]>
  • Iterates over all buckets in pages of predefined size (docs).

    async
    generator
    yields

    {AsyncIterable<IBucket[]>} List of bucket object containing 'bucketKey', 'createdDate', and 'policyKey'.

    throws

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

    Parameters

    • limit: number = 16

    Returns AsyncIterable<IBucket[]>

iterateObjects

  • iterateObjects(bucket: string, limit?: number, beginsWith?: string): AsyncIterable<IObject[]>
  • Iterates over all objects in a bucket in pages of predefined size (docs).

    async
    generator
    yields

    {AsyncIterable<IObject[]>} 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

    • bucket: string

      Bucket key.

    • limit: number = 16
    • Optional beginsWith: string

    Returns AsyncIterable<IObject[]>

listBuckets

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

    async
    throws

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

    Returns Promise<IBucket[]>

    List of bucket objects.

listObjects

  • listObjects(bucket: string, beginsWith?: string): Promise<IObject[]>
  • Lists all objects in a bucket (docs).

    async
    throws

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

    Parameters

    • bucket: string

      Bucket key.

    • Optional beginsWith: string

    Returns Promise<IObject[]>

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

Protected patch

  • patch(endpoint: string, data: any, headers?: {}, scopes: string[]): Promise<any>
  • Parameters

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

    Returns Promise<any>

Protected post

  • post(endpoint: string, data: any, headers?: {}, scopes: string[]): Promise<any>
  • Parameters

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

    Returns Promise<any>

Protected put

  • put(endpoint: string, data: any, headers?: {}, scopes: string[]): Promise<any>
  • Parameters

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

    Returns Promise<any>

reset

  • reset(auth?: { client_id: string; client_secret: string } | { token: string }, host?: string, region?: US | EMEA): void
  • Resets client to specific authentication method, APS host, and availability region.

    Parameters

    • Optional auth: { client_id: string; client_secret: string } | { token: string }
    • Optional host: string
    • Optional region: US | EMEA

    Returns void

Protected setAuthorization

  • setAuthorization(options: any, scopes: string[]): Promise<void>

uploadObject

  • uploadObject(bucketKey: string, objectKey: string, data: Buffer, options?: IUploadOptions): Promise<IObject>
  • Uploads content to a specific bucket object.

    async
    throws

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

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Name of uploaded object.

    • data: Buffer

      Object content.

    • Optional options: IUploadOptions

    Returns Promise<IObject>

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

uploadObjectResumable

  • uploadObjectResumable(bucketKey: string, objectName: string, data: Buffer, byteOffset: number, totalBytes: number, sessionId: string, contentType?: string): 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 (docs).

    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.

    • contentType: string = 'application/stream'

    Returns Promise<any>

uploadObjectStream

  • uploadObjectStream(bucketKey: string, objectKey: string, input: AsyncIterable<Buffer>, options?: IUploadOptions): Promise<IObject>
  • Uploads content stream to a specific bucket object.

    async
    throws

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

    Parameters

    • bucketKey: string

      Bucket key.

    • objectKey: string

      Name of uploaded object.

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

    Returns Promise<IObject>

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

uploadObjectStreamResumable

  • uploadObjectStreamResumable(bucketKey: string, objectName: string, stream: ReadableStream<any>, chunkBytes: number, byteOffset: number, totalBytes: number, sessionId: string, contentType?: string): 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 (docs).

    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.

    • contentType: string = 'application/stream'

    Returns Promise<any>

Generated using TypeDoc