# Files

## Get Pipeline File Status Counts

`FileGetStatusCountsResponse Pipelines.Files.GetStatusCounts(FileGetStatusCountsParamsparameters, CancellationTokencancellationToken = default)`

**get** `/api/v1/pipelines/{pipeline_id}/files/status-counts`

Get files for a pipeline.

### Parameters

- `FileGetStatusCountsParams parameters`

  - `required string pipelineID`

  - `string? dataSourceID`

  - `Boolean onlyManuallyUploaded`

### Returns

- `class FileGetStatusCountsResponse:`

  - `required IReadOnlyDictionary<string, Long> Counts`

    The counts of files by status

  - `required Long TotalCount`

    The total number of files

  - `string? DataSourceID`

    The ID of the data source that the files belong to

  - `Boolean OnlyManuallyUploaded`

    Whether to only count manually uploaded files

  - `string? PipelineID`

    The ID of the pipeline that the files belong to

### Example

```csharp
FileGetStatusCountsParams parameters = new()
{
    PipelineID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
};

var response = await client.Pipelines.Files.GetStatusCounts(parameters);

Console.WriteLine(response);
```

#### Response

```json
{
  "counts": {
    "foo": 0
  },
  "total_count": 0,
  "data_source_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "only_manually_uploaded": true,
  "pipeline_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
```

## Get Pipeline File Status

`ManagedIngestionStatusResponse Pipelines.Files.GetStatus(FileGetStatusParamsparameters, CancellationTokencancellationToken = default)`

**get** `/api/v1/pipelines/{pipeline_id}/files/{file_id}/status`

Get status of a file for a pipeline.

### Parameters

- `FileGetStatusParams parameters`

  - `required string pipelineID`

  - `required string fileID`

### Returns

- `class ManagedIngestionStatusResponse:`

  - `required Status Status`

    Status of the ingestion.

    - `"CANCELLED"Cancelled`

    - `"ERROR"Error`

    - `"IN_PROGRESS"InProgress`

    - `"NOT_STARTED"NotStarted`

    - `"PARTIAL_SUCCESS"PartialSuccess`

    - `"SUCCESS"Success`

  - `DateTimeOffset? DeploymentDate`

    Date of the deployment.

  - `DateTimeOffset? EffectiveAt`

    When the status is effective

  - `IReadOnlyList<Error>? Error`

    List of errors that occurred during ingestion.

    - `required string JobID`

      ID of the job that failed.

    - `required string Message`

      List of errors that occurred during ingestion.

    - `required Step Step`

      Name of the job that failed.

      - `"DATA_SOURCE"DataSource`

      - `"FILE_UPDATER"FileUpdater`

      - `"INGESTION"Ingestion`

      - `"MANAGED_INGESTION"ManagedIngestion`

      - `"METADATA_UPDATE"MetadataUpdate`

      - `"PARSE"Parse`

      - `"TRANSFORM"Transform`

  - `string? JobID`

    ID of the latest job.

### Example

```csharp
FileGetStatusParams parameters = new()
{
    PipelineID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    FileID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
};

var managedIngestionStatusResponse = await client.Pipelines.Files.GetStatus(parameters);

Console.WriteLine(managedIngestionStatusResponse);
```

#### Response

```json
{
  "status": "CANCELLED",
  "deployment_date": "2019-12-27T18:11:19.117Z",
  "effective_at": "2019-12-27T18:11:19.117Z",
  "error": [
    {
      "job_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "message": "message",
      "step": "DATA_SOURCE"
    }
  ],
  "job_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
}
```

## Add Files To Pipeline Api

`IReadOnlyList<PipelineFile> Pipelines.Files.Create(FileCreateParamsparameters, CancellationTokencancellationToken = default)`

**put** `/api/v1/pipelines/{pipeline_id}/files`

Add files to a pipeline.

### Parameters

- `FileCreateParams parameters`

  - `required string pipelineID`

  - `required IReadOnlyList<Body> body`

    - `required string FileID`

      The ID of the file

    - `IReadOnlyDictionary<string, CustomMetadata?>? CustomMetadata`

      Custom metadata for the file

      - `IReadOnlyDictionary<string, JsonElement>`

      - `IReadOnlyList<JsonElement>`

      - `string`

      - `Double`

      - `Boolean`

### Example

```csharp
FileCreateParams parameters = new()
{
    PipelineID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    Body =
    [
        new()
        {
            FileID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            CustomMetadata = new Dictionary<string, CustomMetadata?>()
            {
                { "foo", new(
                    new Dictionary<string, JsonElement>()
                    {
                        { "foo", JsonSerializer.SerializeToElement("bar") }
                    }
                ) },
            },
        },
    ],
};

var pipelineFiles = await client.Pipelines.Files.Create(parameters);

Console.WriteLine(pipelineFiles);
```

#### Response

```json
[
  {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "pipeline_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "config_hash": {
      "foo": {
        "foo": "bar"
      }
    },
    "created_at": "2019-12-27T18:11:19.117Z",
    "custom_metadata": {
      "foo": {
        "foo": "bar"
      }
    },
    "data_source_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "external_file_id": "external_file_id",
    "file_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "file_size": 0,
    "file_type": "file_type",
    "indexed_page_count": 0,
    "last_modified_at": "2019-12-27T18:11:19.117Z",
    "name": "name",
    "permission_info": {
      "foo": {
        "foo": "bar"
      }
    },
    "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "resource_info": {
      "foo": {
        "foo": "bar"
      }
    },
    "status": "CANCELLED",
    "status_updated_at": "2019-12-27T18:11:19.117Z",
    "updated_at": "2019-12-27T18:11:19.117Z"
  }
]
```

## Update Pipeline File

`PipelineFile Pipelines.Files.Update(FileUpdateParamsparameters, CancellationTokencancellationToken = default)`

**put** `/api/v1/pipelines/{pipeline_id}/files/{file_id}`

Update a file for a pipeline.

### Parameters

- `FileUpdateParams parameters`

  - `required string pipelineID`

    Path param

  - `required string fileID`

    Path param

  - `IReadOnlyDictionary<string, CustomMetadata?>? customMetadata`

    Body param: Custom metadata for the file

    - `IReadOnlyDictionary<string, JsonElement>`

    - `IReadOnlyList<JsonElement>`

    - `string`

    - `Double`

    - `Boolean`

### Returns

- `class PipelineFile:`

  A file associated with a pipeline.

  - `required string ID`

    Unique identifier for the pipeline file.

  - `required string PipelineID`

    The ID of the pipeline that the file is associated with.

  - `IReadOnlyDictionary<string, ConfigHash?>? ConfigHash`

    Hashes for the configuration of the pipeline.

    - `IReadOnlyDictionary<string, JsonElement>`

    - `IReadOnlyList<JsonElement>`

    - `string`

    - `Double`

    - `Boolean`

  - `DateTimeOffset? CreatedAt`

    When the pipeline file was created.

  - `IReadOnlyDictionary<string, CustomMetadata?>? CustomMetadata`

    Custom metadata for the file.

    - `IReadOnlyDictionary<string, JsonElement>`

    - `IReadOnlyList<JsonElement>`

    - `string`

    - `Double`

    - `Boolean`

  - `string? DataSourceID`

    The ID of the data source that the file belongs to.

  - `string? ExternalFileID`

    The ID of the file in the external system.

  - `string? FileID`

    The ID of the file.

  - `Long? FileSize`

    Size of the file in bytes.

  - `string? FileType`

    File type (e.g. pdf, docx, etc.).

  - `Long? IndexedPageCount`

    The number of pages that have been indexed for this file.

  - `DateTimeOffset? LastModifiedAt`

    The last modified time of the file.

  - `string? Name`

    Name of the file.

  - `IReadOnlyDictionary<string, PermissionInfo?>? PermissionInfo`

    Permission information for the file.

    - `IReadOnlyDictionary<string, JsonElement>`

    - `IReadOnlyList<JsonElement>`

    - `string`

    - `Double`

    - `Boolean`

  - `string? ProjectID`

    The ID of the project that the file belongs to.

  - `IReadOnlyDictionary<string, ResourceInfo?>? ResourceInfo`

    Resource information for the file.

    - `IReadOnlyDictionary<string, JsonElement>`

    - `IReadOnlyList<JsonElement>`

    - `string`

    - `Double`

    - `Boolean`

  - `Status? Status`

    Status of the pipeline file.

    - `"CANCELLED"Cancelled`

    - `"ERROR"Error`

    - `"IN_PROGRESS"InProgress`

    - `"NOT_STARTED"NotStarted`

    - `"SUCCESS"Success`

  - `DateTimeOffset? StatusUpdatedAt`

    The last time the status was updated.

  - `DateTimeOffset? UpdatedAt`

    When the pipeline file was last updated.

### Example

```csharp
FileUpdateParams parameters = new()
{
    PipelineID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    FileID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
};

var pipelineFile = await client.Pipelines.Files.Update(parameters);

Console.WriteLine(pipelineFile);
```

#### Response

```json
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "pipeline_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "config_hash": {
    "foo": {
      "foo": "bar"
    }
  },
  "created_at": "2019-12-27T18:11:19.117Z",
  "custom_metadata": {
    "foo": {
      "foo": "bar"
    }
  },
  "data_source_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "external_file_id": "external_file_id",
  "file_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "file_size": 0,
  "file_type": "file_type",
  "indexed_page_count": 0,
  "last_modified_at": "2019-12-27T18:11:19.117Z",
  "name": "name",
  "permission_info": {
    "foo": {
      "foo": "bar"
    }
  },
  "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "resource_info": {
    "foo": {
      "foo": "bar"
    }
  },
  "status": "CANCELLED",
  "status_updated_at": "2019-12-27T18:11:19.117Z",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Delete Pipeline File

`Pipelines.Files.Delete(FileDeleteParamsparameters, CancellationTokencancellationToken = default)`

**delete** `/api/v1/pipelines/{pipeline_id}/files/{file_id}`

Delete a file from a pipeline.

### Parameters

- `FileDeleteParams parameters`

  - `required string pipelineID`

  - `required string fileID`

### Example

```csharp
FileDeleteParams parameters = new()
{
    PipelineID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    FileID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
};

await client.Pipelines.Files.Delete(parameters);
```

## List Pipeline Files2

`FileListPageResponse Pipelines.Files.List(FileListParamsparameters, CancellationTokencancellationToken = default)`

**get** `/api/v1/pipelines/{pipeline_id}/files2`

List files for a pipeline with optional filtering, sorting, and pagination.

### Parameters

- `FileListParams parameters`

  - `required string pipelineID`

  - `string? dataSourceID`

  - `string? fileNameContains`

  - `Long? limit`

  - `Long? offset`

  - `Boolean onlyManuallyUploaded`

  - `string? orderBy`

  - `IReadOnlyList<Status>? statuses`

    Filter by file statuses

    - `"CANCELLED"Cancelled`

    - `"ERROR"Error`

    - `"IN_PROGRESS"InProgress`

    - `"NOT_STARTED"NotStarted`

    - `"SUCCESS"Success`

### Returns

- `class FileListPageResponse:`

  Paginated list of pipeline files.

  - `required IReadOnlyList<PipelineFile> Files`

    The files to list

    - `required string ID`

      Unique identifier for the pipeline file.

    - `required string PipelineID`

      The ID of the pipeline that the file is associated with.

    - `IReadOnlyDictionary<string, ConfigHash?>? ConfigHash`

      Hashes for the configuration of the pipeline.

      - `IReadOnlyDictionary<string, JsonElement>`

      - `IReadOnlyList<JsonElement>`

      - `string`

      - `Double`

      - `Boolean`

    - `DateTimeOffset? CreatedAt`

      When the pipeline file was created.

    - `IReadOnlyDictionary<string, CustomMetadata?>? CustomMetadata`

      Custom metadata for the file.

      - `IReadOnlyDictionary<string, JsonElement>`

      - `IReadOnlyList<JsonElement>`

      - `string`

      - `Double`

      - `Boolean`

    - `string? DataSourceID`

      The ID of the data source that the file belongs to.

    - `string? ExternalFileID`

      The ID of the file in the external system.

    - `string? FileID`

      The ID of the file.

    - `Long? FileSize`

      Size of the file in bytes.

    - `string? FileType`

      File type (e.g. pdf, docx, etc.).

    - `Long? IndexedPageCount`

      The number of pages that have been indexed for this file.

    - `DateTimeOffset? LastModifiedAt`

      The last modified time of the file.

    - `string? Name`

      Name of the file.

    - `IReadOnlyDictionary<string, PermissionInfo?>? PermissionInfo`

      Permission information for the file.

      - `IReadOnlyDictionary<string, JsonElement>`

      - `IReadOnlyList<JsonElement>`

      - `string`

      - `Double`

      - `Boolean`

    - `string? ProjectID`

      The ID of the project that the file belongs to.

    - `IReadOnlyDictionary<string, ResourceInfo?>? ResourceInfo`

      Resource information for the file.

      - `IReadOnlyDictionary<string, JsonElement>`

      - `IReadOnlyList<JsonElement>`

      - `string`

      - `Double`

      - `Boolean`

    - `Status? Status`

      Status of the pipeline file.

      - `"CANCELLED"Cancelled`

      - `"ERROR"Error`

      - `"IN_PROGRESS"InProgress`

      - `"NOT_STARTED"NotStarted`

      - `"SUCCESS"Success`

    - `DateTimeOffset? StatusUpdatedAt`

      The last time the status was updated.

    - `DateTimeOffset? UpdatedAt`

      When the pipeline file was last updated.

  - `required Long Limit`

    The limit of the files

  - `required Long Offset`

    The offset of the files

  - `required Long TotalCount`

    The total number of files

### Example

```csharp
FileListParams parameters = new()
{
    PipelineID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
};

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

#### Response

```json
{
  "files": [
    {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "pipeline_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "config_hash": {
        "foo": {
          "foo": "bar"
        }
      },
      "created_at": "2019-12-27T18:11:19.117Z",
      "custom_metadata": {
        "foo": {
          "foo": "bar"
        }
      },
      "data_source_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "external_file_id": "external_file_id",
      "file_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "file_size": 0,
      "file_type": "file_type",
      "indexed_page_count": 0,
      "last_modified_at": "2019-12-27T18:11:19.117Z",
      "name": "name",
      "permission_info": {
        "foo": {
          "foo": "bar"
        }
      },
      "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "resource_info": {
        "foo": {
          "foo": "bar"
        }
      },
      "status": "CANCELLED",
      "status_updated_at": "2019-12-27T18:11:19.117Z",
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "limit": 0,
  "offset": 0,
  "total_count": 0
}
```

## Domain Types

### Pipeline File

- `class PipelineFile:`

  A file associated with a pipeline.

  - `required string ID`

    Unique identifier for the pipeline file.

  - `required string PipelineID`

    The ID of the pipeline that the file is associated with.

  - `IReadOnlyDictionary<string, ConfigHash?>? ConfigHash`

    Hashes for the configuration of the pipeline.

    - `IReadOnlyDictionary<string, JsonElement>`

    - `IReadOnlyList<JsonElement>`

    - `string`

    - `Double`

    - `Boolean`

  - `DateTimeOffset? CreatedAt`

    When the pipeline file was created.

  - `IReadOnlyDictionary<string, CustomMetadata?>? CustomMetadata`

    Custom metadata for the file.

    - `IReadOnlyDictionary<string, JsonElement>`

    - `IReadOnlyList<JsonElement>`

    - `string`

    - `Double`

    - `Boolean`

  - `string? DataSourceID`

    The ID of the data source that the file belongs to.

  - `string? ExternalFileID`

    The ID of the file in the external system.

  - `string? FileID`

    The ID of the file.

  - `Long? FileSize`

    Size of the file in bytes.

  - `string? FileType`

    File type (e.g. pdf, docx, etc.).

  - `Long? IndexedPageCount`

    The number of pages that have been indexed for this file.

  - `DateTimeOffset? LastModifiedAt`

    The last modified time of the file.

  - `string? Name`

    Name of the file.

  - `IReadOnlyDictionary<string, PermissionInfo?>? PermissionInfo`

    Permission information for the file.

    - `IReadOnlyDictionary<string, JsonElement>`

    - `IReadOnlyList<JsonElement>`

    - `string`

    - `Double`

    - `Boolean`

  - `string? ProjectID`

    The ID of the project that the file belongs to.

  - `IReadOnlyDictionary<string, ResourceInfo?>? ResourceInfo`

    Resource information for the file.

    - `IReadOnlyDictionary<string, JsonElement>`

    - `IReadOnlyList<JsonElement>`

    - `string`

    - `Double`

    - `Boolean`

  - `Status? Status`

    Status of the pipeline file.

    - `"CANCELLED"Cancelled`

    - `"ERROR"Error`

    - `"IN_PROGRESS"InProgress`

    - `"NOT_STARTED"NotStarted`

    - `"SUCCESS"Success`

  - `DateTimeOffset? StatusUpdatedAt`

    The last time the status was updated.

  - `DateTimeOffset? UpdatedAt`

    When the pipeline file was last updated.
