# Attachments

## List Attachments

`AttachmentListPageResponse Beta.Attachments.List(AttachmentListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/api/v1/beta/attachments`

List the attachments associated with a file (e.g. per-page screenshots).

### Parameters

- `AttachmentListParams parameters`

  - `required string sourceID`

    File UUID or directory file ID (dfl-...).

  - `string? organizationID`

  - `Long? pageSize`

  - `string? pageToken`

  - `string? projectID`

### Returns

- `class AttachmentListPageResponse:`

  Paginated list of file attachments.

  - `required IReadOnlyList<AttachmentListResponse> Items`

    The list of items.

    - `required string Name`

      Name of the attachment

    - `required Long Size`

      Size of the attachment in bytes

    - `DateTimeOffset? LastModified`

      When the attachment was last modified

  - `string? NextPageToken`

    A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

  - `Long? TotalSize`

    The total number of items available. This is only populated when specifically requested. The value may be an estimate and can be used for display purposes only.

### Example

```csharp
AttachmentListParams parameters = new() { SourceID = "source_id" };

var page = await client.Beta.Attachments.List(parameters);
await foreach (var item in page.Paginate())
{
    Console.WriteLine(item);
}
```

#### Response

```json
{
  "items": [
    {
      "name": "name",
      "size": 0,
      "last_modified": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Get Attachment

`PresignedUrl Beta.Attachments.Get(AttachmentGetParamsparameters, CancellationTokencancellationToken = default)`

**get** `/api/v1/beta/attachments/{attachment_name}`

Return a presigned download URL for a specific attachment.

### Parameters

- `AttachmentGetParams parameters`

  - `required string attachmentName`

  - `required string sourceID`

    File UUID or directory file ID (dfl-...).

  - `string? organizationID`

  - `string? projectID`

### Returns

- `class PresignedUrl:`

  Schema for a presigned URL.

  - `required DateTimeOffset ExpiresAt`

    The time at which the presigned URL expires

  - `required string Url`

    A presigned URL for IO operations against a private file

  - `IReadOnlyDictionary<string, string>? FormFields`

    Form fields for a presigned POST request

### Example

```csharp
AttachmentGetParams parameters = new()
{
    AttachmentName = "attachment_name",
    SourceID = "source_id",
};

var presignedUrl = await client.Beta.Attachments.Get(parameters);

Console.WriteLine(presignedUrl);
```

#### Response

```json
{
  "expires_at": "2019-12-27T18:11:19.117Z",
  "url": "https://example.com",
  "form_fields": {
    "foo": "string"
  }
}
```
