# Projects

## List Projects

`client.Projects.List(ctx, query) (*PaginatedCursor[Project], error)`

**get** `/api/v2/projects`

List projects in an organization. Requires `organization_id` or a project-scoped API key.

### Parameters

- `query ProjectListParams`

  - `Name param.Field[string]`

  - `OrganizationID param.Field[string]`

  - `PageSize param.Field[int64]`

  - `PageToken param.Field[string]`

### Returns

- `type Project struct{…}`

  API response schema for a project.

  - `ID string`

    The project's unique identifier.

  - `Name string`

    The project's display name.

  - `OrganizationID string`

    The organization the project belongs to.

  - `CreatedAt Time`

    Creation datetime

  - `IsDefault bool`

    Whether this project is the default project for its organization.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.Projects.List(context.TODO(), llamacloudadmin.ProjectListParams{

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

#### Response

```json
{
  "items": [
    {
      "id": "id",
      "name": "name",
      "organization_id": "organization_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "is_default": true,
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
```

## Create Project

`client.Projects.New(ctx, params) (*Project, error)`

**post** `/api/v2/projects`

Create a new project in the given organization.

### Parameters

- `params ProjectNewParams`

  - `OrganizationID param.Field[string]`

    Query param

  - `Name param.Field[string]`

    Body param: The project's display name.

### Returns

- `type Project struct{…}`

  API response schema for a project.

  - `ID string`

    The project's unique identifier.

  - `Name string`

    The project's display name.

  - `OrganizationID string`

    The organization the project belongs to.

  - `CreatedAt Time`

    Creation datetime

  - `IsDefault bool`

    Whether this project is the default project for its organization.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  project, err := client.Projects.New(context.TODO(), llamacloudadmin.ProjectNewParams{
    OrganizationID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    Name: "x",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", project.ID)
}
```

#### Response

```json
{
  "id": "id",
  "name": "name",
  "organization_id": "organization_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "is_default": true,
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Get Project

`client.Projects.Get(ctx, projectID, query) (*Project, error)`

**get** `/api/v2/projects/{project_id}`

Get a project by ID.

### Parameters

- `projectID string`

- `query ProjectGetParams`

  - `OrganizationID param.Field[string]`

### Returns

- `type Project struct{…}`

  API response schema for a project.

  - `ID string`

    The project's unique identifier.

  - `Name string`

    The project's display name.

  - `OrganizationID string`

    The organization the project belongs to.

  - `CreatedAt Time`

    Creation datetime

  - `IsDefault bool`

    Whether this project is the default project for its organization.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  project, err := client.Projects.Get(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.ProjectGetParams{

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

#### Response

```json
{
  "id": "id",
  "name": "name",
  "organization_id": "organization_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "is_default": true,
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Update Existing Project

`client.Projects.Update(ctx, projectID, params) (*Project, error)`

**put** `/api/v2/projects/{project_id}`

Update an existing project.

### Parameters

- `projectID string`

- `params ProjectUpdateParams`

  - `Name param.Field[string]`

    Body param: The project's new display name.

  - `OrganizationID param.Field[string]`

    Query param

### Returns

- `type Project struct{…}`

  API response schema for a project.

  - `ID string`

    The project's unique identifier.

  - `Name string`

    The project's display name.

  - `OrganizationID string`

    The organization the project belongs to.

  - `CreatedAt Time`

    Creation datetime

  - `IsDefault bool`

    Whether this project is the default project for its organization.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  project, err := client.Projects.Update(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.ProjectUpdateParams{
      Name: "x",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", project.ID)
}
```

#### Response

```json
{
  "id": "id",
  "name": "name",
  "organization_id": "organization_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "is_default": true,
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```

## Delete Project

`client.Projects.Delete(ctx, projectID, body) error`

**delete** `/api/v2/projects/{project_id}`

Delete a project by ID.

### Parameters

- `projectID string`

- `body ProjectDeleteParams`

  - `OrganizationID param.Field[string]`

### Example

```go
package main

import (
  "context"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  err := client.Projects.Delete(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.ProjectDeleteParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
}
```

## Domain Types

### Project

- `type Project struct{…}`

  API response schema for a project.

  - `ID string`

    The project's unique identifier.

  - `Name string`

    The project's display name.

  - `OrganizationID string`

    The organization the project belongs to.

  - `CreatedAt Time`

    Creation datetime

  - `IsDefault bool`

    Whether this project is the default project for its organization.

  - `UpdatedAt Time`

    Update datetime
