## List dataset items

`client.DatasetItems.List(ctx, query) (*CursorPage[DatasetItem], error)`

**get** `/v5/dataset-items`

List dataset items belonging to the caller's account, paginated.

dataset_id is optional: when omitted, items across all of the account's datasets are returned;
when provided, results are restricted to that dataset. A specific version may be requested only
together with a dataset_id — passing version without dataset_id is rejected. By default only
current items at the latest version are listed (soft-deleted items are excluded); archived items
are excluded unless include_archived is true.

### Parameters

- `query DatasetItemListParams`

  - `DatasetID param.Field[string]`

    Optional dataset identifier. Must be provided if a specific version is requested.

  - `EndingBefore param.Field[string]`

  - `IncludeArchived param.Field[bool]`

  - `Limit param.Field[int64]`

  - `SortBy param.Field[string]`

  - `SortOrder param.Field[SortOrder]`

  - `StartingAfter param.Field[string]`

  - `Version param.Field[int64]`

    Optional dataset version. When unset, returns the latest version. Requires a valid dataset_id when set.

### Returns

- `type DatasetItem struct{…}`

  - `ID string`

    The unique identifier of the entity.

  - `ContentHash string`

  - `CreatedAt Time`

    The date and time when the entity was created in ISO format.

  - `CreatedBy Identity`

    The identity that created the entity.

    - `ID string`

    - `Type IdentityType`

      - `const IdentityTypeUser IdentityType = "user"`

      - `const IdentityTypeServiceAccount IdentityType = "service_account"`

    - `Object IdentityObject`

      - `const IdentityObjectIdentity IdentityObject = "identity"`

  - `Data map[string, any]`

  - `UpdatedAt Time`

    The date and time when the entity was last updated in ISO format.

  - `ArchivedAt Time`

    The date and time when the entity was archived in ISO format.

  - `DatasetID string`

  - `Files map[string, string]`

  - `Object DatasetItemObject`

    - `const DatasetItemObjectDatasetItem DatasetItemObject = "dataset.item"`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  page, err := client.DatasetItems.List(context.TODO(), sgpdev.DatasetItemListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
```

#### Response

```json
{
  "has_more": true,
  "items": [
    {
      "id": "id",
      "content_hash": "content_hash",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": {
        "id": "id",
        "type": "user",
        "object": "identity"
      },
      "data": {
        "foo": "bar"
      },
      "updated_at": "2019-12-27T18:11:19.117Z",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "dataset_id": "dataset_id",
      "files": {
        "foo": "string"
      },
      "object": "dataset.item"
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}
```
