# Class LayerAttachmentsApi`Alpha`

Represents the Layer Attachments API. Contains methods to work with layer attachments for a specific layer. This class is not fully tested yet. Use with caution.

##### Index

### Constructors

constructor

### Methods

add
canAdd
canUpdate
delete
get
isAttachment
update

## Constructors

### constructor

- new LayerAttachmentsApi(
  _clientApi: TwinfinityApiClient,
  _parent: {
  layer: BimChangeLayer;
  throwIfNoPermissionsAreSatisfied(
  ...requiredPermissions: Permission[],
  ): void;
  },
  ): LayerAttachmentsApi
  `Alpha`

  Creates a new instance of the LayerAttachmentsApiImpl class.

  #### Parameters

  - _clientApi: TwinfinityApiClient

    The TwinfinityApiClient instance.

  - _parent: {
    layer: BimChangeLayer;
    throwIfNoPermissionsAreSatisfied(
    ...requiredPermissions: Permission[],
    ): void;
    }

    The parent object containing the layer and permission-related methods.

  #### Returns LayerAttachmentsApi

## Methods

### add

- add<Change extends BimChangeUploadable = BimChangeUploadable>(
  options: Pick<
  UploadClientOperationCreate,
  "metadata"
  | "content"
  | "filename",
  >,
  ): Promise<UploadApiClientFailure | UploadApiTask<Change>>
  `Alpha`

  Adds a new attachment to the layer.

  #### Type Parameters

  - Change extends BimChangeUploadable = BimChangeUploadable

  #### Parameters

  - options: Pick<UploadClientOperationCreate, "metadata" | "content" | "filename">

    The options for creating the attachment.

  #### Returns Promise<UploadApiClientFailure | UploadApiTask<Change>>

  A promise that resolves to the created attachment or an error.

### canAdd

- canAdd(): boolean
  `Alpha`

  Determines whether the caller has sufficient permissions to add attachments to the layer.

  #### Returns boolean

  True if attachments can be added to the layer, false otherwise.

### canUpdate

- canUpdate(attachment: BimChangeUploadable): boolean
  `Alpha`

  Determines whether the caller has sufficient permissions to update a attachment (create a new version of it) on the layer.

  #### Parameters

  - attachment: BimChangeUploadable

    The attachment to check.

  #### Returns boolean

  True if the attachment can be updated (new version created), false otherwise.

### delete

- delete(changes: BimChangeUploadable[]): Promise<TypedResponse<number>[]>
  `Alpha`

  Deletes the specified attachments from the layer.

  #### Parameters

  - changes: BimChangeUploadable[]

    The attachments to delete.

  #### Returns Promise<TypedResponse<number>[]>

  A promise that resolves to the number of deleted attachments or an error.

### get

- get<Change extends BimChangeUploadable = BimChangeUploadable>(): Promise<
  TypedResponse<Change[]>,
  >
  `Alpha`

  Retrieves all attachments of the layer (may be none).

  #### Type Parameters

  - Change extends BimChangeUploadable = BimChangeUploadable

  #### Returns Promise<TypedResponse<Change[]>>

  List of attachments.

### isAttachment

- isAttachment(change: BimChangeUploadable): boolean
  `Alpha`

  Checks if the given change is an attachment of the layer.

  #### Parameters

  - change: BimChangeUploadable

    The change to check.

  #### Returns boolean

  True if the change is an attachment of the layer, false otherwise.

### update

- update<Change extends BimChangeUploadable = BimChangeUploadable>(
  attachment: Change,
  options: Pick<
  UploadClientOperationAppendFileVersion<Change>,
  "metadata" | "content",
  >,
  ): Promise<UploadApiClientFailure | UploadApiTask<Change>>
  `Alpha`

  Updates an existing attachment with a new version.

  #### Type Parameters

  - Change extends BimChangeUploadable = BimChangeUploadable

  #### Parameters

  - attachment: Change

    The attachment to update.

  - options: Pick<UploadClientOperationAppendFileVersion<Change>, "metadata" | "content">

    The options for updating the attachment.

  #### Returns Promise<UploadApiClientFailure | UploadApiTask<Change>>

  A promise that resolves to the updated attachment or an error.