Skip to content
Docs
Reference

BackstageClient.assets

BackstageClient.assets in @ticketlayer/backstage.

@ticketlayer/backstage


@ticketlayer/backstage / BackstageClient / assets

assets: {
  completeUpload: (id: string, request: {
     sha256?: string;
   }, requestOptions?: RequestOptions) => Promise<{
     accountId: string | null;
     cdn: boolean;
     cdnUrl: string | null;
     contentType: string;
     createdAt: string;
     filename: string | null;
     id: string;
     metadata: {
      [key: string]: unknown;
     };
     name: string | null;
     organisationId: string;
     ownerId: string | null;
     ownerType: string | null;
     purpose: string;
     signedUrl: string | null;
     signedUrlExpiresAt: string | null;
     sizeBytes: number;
     storageBucket: string | null;
     storageDriver: string;
     storageKey: string;
     updatedAt: string;
     uploadedBy: string | null;
     url: string;
     visibility: string;
  }>;
  createUpload: (request: {
     accountId?: string;
     contentType:   | "model/gltf-binary"
        | "application/zip"
        | "application/gzip"
        | "application/x-gzip";
     filename: string;
     name?: string;
     purpose: "venue_model";
     sizeBytes: number;
   }, requestOptions?: RequestOptions) => Promise<{
     asset: {
        accountId: string | null;
        cdn: boolean;
        cdnUrl: string | null;
        contentType: string;
        createdAt: string;
        filename: string | null;
        id: string;
        metadata: {
         [key: string]: unknown;
        };
        name: string | null;
        organisationId: string;
        ownerId: string | null;
        ownerType: string | null;
        purpose: string;
        signedUrl: string | null;
        signedUrlExpiresAt: string | null;
        sizeBytes: number;
        storageBucket: string | null;
        storageDriver: string;
        storageKey: string;
        updatedAt: string;
        uploadedBy: string | null;
        url: string;
        visibility: string;
     };
     upload: {
        expiresAt: string;
        headers: {
         [key: string]: string;
        };
        method: "PUT";
        url: string;
     };
  }>;
  delete: (id: string, requestOptions?: RequestOptions) => Promise<boolean>;
  get: (id: string, requestOptions?: RequestOptions) => Promise<{
     accountId: string | null;
     cdn: boolean;
     cdnUrl: string | null;
     contentType: string;
     createdAt: string;
     filename: string | null;
     id: string;
     metadata: {
      [key: string]: unknown;
     };
     name: string | null;
     organisationId: string;
     ownerId: string | null;
     ownerType: string | null;
     purpose: string;
     signedUrl: string | null;
     signedUrlExpiresAt: string | null;
     sizeBytes: number;
     storageBucket: string | null;
     storageDriver: string;
     storageKey: string;
     updatedAt: string;
     uploadedBy: string | null;
     url: string;
     visibility: string;
  }>;
  getContent: (id: string, requestOptions?: RequestOptions) => Promise<any>;
  list: (options?: {
     accountId?: string;
     ownerId?: string;
     ownerType?: string;
     purpose?: string;
     q?: string;
   }, requestOptions?: RequestOptions) => Promise<{
     accountId: string | null;
     cdn: boolean;
     cdnUrl: string | null;
     contentType: string;
     createdAt: string;
     filename: string | null;
     id: string;
     metadata: {
      [key: string]: unknown;
     };
     name: string | null;
     organisationId: string;
     ownerId: string | null;
     ownerType: string | null;
     purpose: string;
     signedUrl: string | null;
     signedUrlExpiresAt: string | null;
     sizeBytes: number;
     storageBucket: string | null;
     storageDriver: string;
     storageKey: string;
     updatedAt: string;
     uploadedBy: string | null;
     url: string;
     visibility: string;
  }[]>;
  upload: (request: {
     accountId?: string;
     cdn?: any;
     name?: string;
     ownerId?: string;
     ownerType?: string;
     purpose?:   | "other"
        | "event_image"
        | "organisation_logo"
        | "account_logo"
        | "user_avatar"
        | "ticket_template_asset"
        | "rendered_pass"
        | "rendered_receipt"
        | "export"
        | "seat_map_source";
     visibility?: "public" | "private";
   }, requestOptions?: RequestOptions) => Promise<{
     accountId: string | null;
     cdn: boolean;
     cdnUrl: string | null;
     contentType: string;
     createdAt: string;
     filename: string | null;
     id: string;
     metadata: {
      [key: string]: unknown;
     };
     name: string | null;
     organisationId: string;
     ownerId: string | null;
     ownerType: string | null;
     purpose: string;
     signedUrl: string | null;
     signedUrlExpiresAt: string | null;
     sizeBytes: number;
     storageBucket: string | null;
     storageDriver: string;
     storageKey: string;
     updatedAt: string;
     uploadedBy: string | null;
     url: string;
     visibility: string;
  }>;
};

Defined in: client.ts:9485

Assets methods

completeUpload()#

completeUpload: (id: string, request: {
  sha256?: string;
}, requestOptions?: RequestOptions) => Promise<{
  accountId: string | null;
  cdn: boolean;
  cdnUrl: string | null;
  contentType: string;
  createdAt: string;
  filename: string | null;
  id: string;
  metadata: {
   [key: string]: unknown;
  };
  name: string | null;
  organisationId: string;
  ownerId: string | null;
  ownerType: string | null;
  purpose: string;
  signedUrl: string | null;
  signedUrlExpiresAt: string | null;
  sizeBytes: number;
  storageBucket: string | null;
  storageDriver: string;
  storageKey: string;
  updatedAt: string;
  uploadedBy: string | null;
  url: string;
  visibility: string;
}>;

Complete a signed upload Records the size and sha256 of the bytes that arrived at the signed URL (read from the bucket, streamed), and checks the client's sha256 when it sends one. Idempotent. 409 ASSET_UPLOAD_INCOMPLETE while nothing has arrived, ASSET_CHECKSUM_MISMATCH when the sha256 is not the bytes'.

Parameters#

ParameterType
idstring
request{ sha256?: string; }
request.sha256?string
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string | null; cdn: boolean; cdnUrl: string | null; contentType: string; createdAt: string; filename: string | null; id: string; metadata: { [key: string]: unknown; }; name: string | null; organisationId: string; ownerId: string | null; ownerType: string | null; purpose: string; signedUrl: string | null; signedUrlExpiresAt: string | null; sizeBytes: number; storageBucket: string | null; storageDriver: string; storageKey: string; updatedAt: string; uploadedBy: string | null; url: string; visibility: string; }>

Operation Id#

completeAssetUpload

createUpload()#

createUpload: (request: {
  accountId?: string;
  contentType:   | "model/gltf-binary"
     | "application/zip"
     | "application/gzip"
     | "application/x-gzip";
  filename: string;
  name?: string;
  purpose: "venue_model";
  sizeBytes: number;
}, requestOptions?: RequestOptions) => Promise<{
  asset: {
     accountId: string | null;
     cdn: boolean;
     cdnUrl: string | null;
     contentType: string;
     createdAt: string;
     filename: string | null;
     id: string;
     metadata: {
      [key: string]: unknown;
     };
     name: string | null;
     organisationId: string;
     ownerId: string | null;
     ownerType: string | null;
     purpose: string;
     signedUrl: string | null;
     signedUrlExpiresAt: string | null;
     sizeBytes: number;
     storageBucket: string | null;
     storageDriver: string;
     storageKey: string;
     updatedAt: string;
     uploadedBy: string | null;
     url: string;
     visibility: string;
  };
  upload: {
     expiresAt: string;
     headers: {
      [key: string]: string;
     };
     method: "PUT";
     url: string;
  };
}>;

Start a signed upload For a file too big for POST /assets: a venue's captured or CAD 3D model (purpose venue_model), a glTF binary or a venue package as .zip or .tar.gz, up to 5 GiB. Records the asset, private and pending, and answers a signed PUT to the seat map bucket's private prefix; PUT the bytes there, then POST /assets/{id}/complete. 400 ASSET_TYPE_NOT_ALLOWED for another content type; 409 SEATMAP_PUBLISHER_OFF when the deployment has no seat map bucket.

Parameters#

ParameterType
request{ accountId?: string; contentType: | "model/gltf-binary" | "application/zip" | "application/gzip" | "application/x-gzip"; filename: string; name?: string; purpose: "venue_model"; sizeBytes: number; }
request.accountId?string
request.contentType?| "model/gltf-binary" | "application/zip" | "application/gzip" | "application/x-gzip"
request.filename?string
request.name?string
request.purpose?"venue_model"
request.sizeBytes?number
requestOptions?RequestOptions

Returns#

Promise<{ asset: { accountId: string | null; cdn: boolean; cdnUrl: string | null; contentType: string; createdAt: string; filename: string | null; id: string; metadata: { [key: string]: unknown; }; name: string | null; organisationId: string; ownerId: string | null; ownerType: string | null; purpose: string; signedUrl: string | null; signedUrlExpiresAt: string | null; sizeBytes: number; storageBucket: string | null; storageDriver: string; storageKey: string; updatedAt: string; uploadedBy: string | null; url: string; visibility: string; }; upload: { expiresAt: string; headers: { [key: string]: string; }; method: "PUT"; url: string; }; }>

Operation Id#

createAssetUpload

delete()#

delete: (id: string, requestOptions?: RequestOptions) => Promise<boolean>;

Delete an asset Soft-delete a tracked asset (bytes are left in storage for later GC).

Parameters#

ParameterType
idstring
requestOptions?RequestOptions

Returns#

Promise<boolean>

Operation Id#

deleteAsset

get()#

get: (id: string, requestOptions?: RequestOptions) => Promise<{
  accountId: string | null;
  cdn: boolean;
  cdnUrl: string | null;
  contentType: string;
  createdAt: string;
  filename: string | null;
  id: string;
  metadata: {
   [key: string]: unknown;
  };
  name: string | null;
  organisationId: string;
  ownerId: string | null;
  ownerType: string | null;
  purpose: string;
  signedUrl: string | null;
  signedUrlExpiresAt: string | null;
  sizeBytes: number;
  storageBucket: string | null;
  storageDriver: string;
  storageKey: string;
  updatedAt: string;
  uploadedBy: string | null;
  url: string;
  visibility: string;
}>;

Get an asset Get a tracked asset by id.

Parameters#

ParameterType
idstring
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string | null; cdn: boolean; cdnUrl: string | null; contentType: string; createdAt: string; filename: string | null; id: string; metadata: { [key: string]: unknown; }; name: string | null; organisationId: string; ownerId: string | null; ownerType: string | null; purpose: string; signedUrl: string | null; signedUrlExpiresAt: string | null; sizeBytes: number; storageBucket: string | null; storageDriver: string; storageKey: string; updatedAt: string; uploadedBy: string | null; url: string; visibility: string; }>

Operation Id#

getAsset

getContent()#

getContent: (id: string, requestOptions?: RequestOptions) => Promise<any>;

Get an asset's bytes The asset's bytes, with its content type, to a credential of its organisation that may read it, whatever its visibility. How a private asset such as a seat_map_source is read back without a signed URL; never cached. Clients fetch this directly rather than through the typed SDK.

Parameters#

ParameterType
idstring
requestOptions?RequestOptions

Returns#

Promise<any>

Operation Id#

getAssetContent

list()#

list: (options?: {
  accountId?: string;
  ownerId?: string;
  ownerType?: string;
  purpose?: string;
  q?: string;
}, requestOptions?: RequestOptions) => Promise<{
  accountId: string | null;
  cdn: boolean;
  cdnUrl: string | null;
  contentType: string;
  createdAt: string;
  filename: string | null;
  id: string;
  metadata: {
   [key: string]: unknown;
  };
  name: string | null;
  organisationId: string;
  ownerId: string | null;
  ownerType: string | null;
  purpose: string;
  signedUrl: string | null;
  signedUrlExpiresAt: string | null;
  sizeBytes: number;
  storageBucket: string | null;
  storageDriver: string;
  storageKey: string;
  updatedAt: string;
  uploadedBy: string | null;
  url: string;
  visibility: string;
}[]>;

List assets List the organisation's tracked assets (uploads + renders). Filter by purpose/owner.

Parameters#

ParameterType
options?{ accountId?: string; ownerId?: string; ownerType?: string; purpose?: string; q?: string; }
options.accountId?string
options.ownerId?string
options.ownerType?string
options.purpose?string
options.q?string
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string | null; cdn: boolean; cdnUrl: string | null; contentType: string; createdAt: string; filename: string | null; id: string; metadata: { [key: string]: unknown; }; name: string | null; organisationId: string; ownerId: string | null; ownerType: string | null; purpose: string; signedUrl: string | null; signedUrlExpiresAt: string | null; sizeBytes: number; storageBucket: string | null; storageDriver: string; storageKey: string; updatedAt: string; uploadedBy: string | null; url: string; visibility: string; }[]>

Operation Id#

listAssets

upload()#

upload: (request: {
  accountId?: string;
  cdn?: any;
  name?: string;
  ownerId?: string;
  ownerType?: string;
  purpose?:   | "other"
     | "event_image"
     | "organisation_logo"
     | "account_logo"
     | "user_avatar"
     | "ticket_template_asset"
     | "rendered_pass"
     | "rendered_receipt"
     | "export"
     | "seat_map_source";
  visibility?: "public" | "private";
}, requestOptions?: RequestOptions) => Promise<{
  accountId: string | null;
  cdn: boolean;
  cdnUrl: string | null;
  contentType: string;
  createdAt: string;
  filename: string | null;
  id: string;
  metadata: {
   [key: string]: unknown;
  };
  name: string | null;
  organisationId: string;
  ownerId: string | null;
  ownerType: string | null;
  purpose: string;
  signedUrl: string | null;
  signedUrlExpiresAt: string | null;
  sizeBytes: number;
  storageBucket: string | null;
  storageDriver: string;
  storageKey: string;
  updatedAt: string;
  uploadedBy: string | null;
  url: string;
  visibility: string;
}>;

Upload an asset Upload a file (multipart/form-data; field "file") to central storage and track it. Metadata fields (purpose, ownerType, ownerId, accountId, visibility, cdn) accompany the file. An image for any purpose; purpose seat_map_source takes a venue's existing seating plan as a PDF, PNG, JPEG or WebP (checked against the bytes), or a seat list exported from another system as text/csv or text/plain (checked as UTF-8 text), 400 ASSET_TYPE_NOT_ALLOWED otherwise; it is always private, and is read back with GET /assets/{id}/content.

Parameters#

ParameterType
request{ accountId?: string; cdn?: any; name?: string; ownerId?: string; ownerType?: string; purpose?: | "other" | "event_image" | "organisation_logo" | "account_logo" | "user_avatar" | "ticket_template_asset" | "rendered_pass" | "rendered_receipt" | "export" | "seat_map_source"; visibility?: "public" | "private"; }
request.accountId?string
request.cdn?any
request.name?string
request.ownerId?string
request.ownerType?string
request.purpose?| "other" | "event_image" | "organisation_logo" | "account_logo" | "user_avatar" | "ticket_template_asset" | "rendered_pass" | "rendered_receipt" | "export" | "seat_map_source"
request.visibility?"public" | "private"
requestOptions?RequestOptions

Returns#

Promise<{ accountId: string | null; cdn: boolean; cdnUrl: string | null; contentType: string; createdAt: string; filename: string | null; id: string; metadata: { [key: string]: unknown; }; name: string | null; organisationId: string; ownerId: string | null; ownerType: string | null; purpose: string; signedUrl: string | null; signedUrlExpiresAt: string | null; sizeBytes: number; storageBucket: string | null; storageDriver: string; storageKey: string; updatedAt: string; uploadedBy: string | null; url: string; visibility: string; }>

Operation Id#

uploadAsset