# Projects

## Create Project

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

**post** `/v1/projects`

Create a new project

### Parameters

- `body ProjectNewParams`

  - `Name param.Field[string]`

    Project name.

  - `Tags param.Field[[]string]`

    Tags to attach to the Project.

### Returns

- `type Project struct{…}`

  Project response.

  - `ID string`

    Project ID.

  - `CreatedAt Time`

    When the Project was created.

  - `Name string`

    Project name.

  - `Resources ProjectResources`

    Resource counts for the project.

    - `Blockchain ProjectBlockchainResources`

      Blockchain resources.

      - `RPCNodesDedicated int64`

        Number of dedicated RPC nodes in the project.

      - `RPCNodesFlex int64`

        Number of flex RPC nodes in the project.

    - `Cloud ProjectCloudResources`

      Cloud infrastructure resources.

      - `ConnectConnections int64`

        Number of Connect connections in the project.

      - `NKSClusters int64`

        Number of NKS clusters in the project.

      - `NKSNodePools int64`

        Number of NKS node pools in the project.

      - `VMs int64`

        Number of VMs in the project.

      - `Volumes int64`

        Number of volumes in the project.

      - `VPCs int64`

        Number of VPCs in the project.

  - `Tags []string`

    Tags attached to the Project.

  - `UpdatedAt Time`

    When the Project was updated.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/nirvana-labs/nirvana-go"
  "github.com/nirvana-labs/nirvana-go/option"
  "github.com/nirvana-labs/nirvana-go/projects"
)

func main() {
  client := nirvana.NewClient(
    option.WithAPIKey("My API Key"),
  )
  project, err := client.Projects.New(context.TODO(), projects.ProjectNewParams{
    Name: "My Project",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", project.ID)
}
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "name": "My Project",
  "resources": {
    "blockchain": {
      "rpc_nodes_dedicated": 1,
      "rpc_nodes_flex": 3
    },
    "cloud": {
      "connect_connections": 1,
      "nks_clusters": 2,
      "nks_node_pools": 4,
      "vms": 5,
      "volumes": 10,
      "vpcs": 2
    }
  },
  "tags": [
    "production",
    "ethereum"
  ],
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Get Project Details

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

**get** `/v1/projects/{project_id}`

Get details about a project

### Parameters

- `projectID string`

### Returns

- `type Project struct{…}`

  Project response.

  - `ID string`

    Project ID.

  - `CreatedAt Time`

    When the Project was created.

  - `Name string`

    Project name.

  - `Resources ProjectResources`

    Resource counts for the project.

    - `Blockchain ProjectBlockchainResources`

      Blockchain resources.

      - `RPCNodesDedicated int64`

        Number of dedicated RPC nodes in the project.

      - `RPCNodesFlex int64`

        Number of flex RPC nodes in the project.

    - `Cloud ProjectCloudResources`

      Cloud infrastructure resources.

      - `ConnectConnections int64`

        Number of Connect connections in the project.

      - `NKSClusters int64`

        Number of NKS clusters in the project.

      - `NKSNodePools int64`

        Number of NKS node pools in the project.

      - `VMs int64`

        Number of VMs in the project.

      - `Volumes int64`

        Number of volumes in the project.

      - `VPCs int64`

        Number of VPCs in the project.

  - `Tags []string`

    Tags attached to the Project.

  - `UpdatedAt Time`

    When the Project was updated.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/nirvana-labs/nirvana-go"
  "github.com/nirvana-labs/nirvana-go/option"
)

func main() {
  client := nirvana.NewClient(
    option.WithAPIKey("My API Key"),
  )
  project, err := client.Projects.Get(context.TODO(), "project_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", project.ID)
}
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "name": "My Project",
  "resources": {
    "blockchain": {
      "rpc_nodes_dedicated": 1,
      "rpc_nodes_flex": 3
    },
    "cloud": {
      "connect_connections": 1,
      "nks_clusters": 2,
      "nks_node_pools": 4,
      "vms": 5,
      "volumes": 10,
      "vpcs": 2
    }
  },
  "tags": [
    "production",
    "ethereum"
  ],
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Update Project

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

**patch** `/v1/projects/{project_id}`

Update an existing project

### Parameters

- `projectID string`

- `body ProjectUpdateParams`

  - `Name param.Field[string]`

    Project name.

  - `Tags param.Field[[]string]`

    Tags to attach to the Project.

### Returns

- `type Project struct{…}`

  Project response.

  - `ID string`

    Project ID.

  - `CreatedAt Time`

    When the Project was created.

  - `Name string`

    Project name.

  - `Resources ProjectResources`

    Resource counts for the project.

    - `Blockchain ProjectBlockchainResources`

      Blockchain resources.

      - `RPCNodesDedicated int64`

        Number of dedicated RPC nodes in the project.

      - `RPCNodesFlex int64`

        Number of flex RPC nodes in the project.

    - `Cloud ProjectCloudResources`

      Cloud infrastructure resources.

      - `ConnectConnections int64`

        Number of Connect connections in the project.

      - `NKSClusters int64`

        Number of NKS clusters in the project.

      - `NKSNodePools int64`

        Number of NKS node pools in the project.

      - `VMs int64`

        Number of VMs in the project.

      - `Volumes int64`

        Number of volumes in the project.

      - `VPCs int64`

        Number of VPCs in the project.

  - `Tags []string`

    Tags attached to the Project.

  - `UpdatedAt Time`

    When the Project was updated.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/nirvana-labs/nirvana-go"
  "github.com/nirvana-labs/nirvana-go/option"
  "github.com/nirvana-labs/nirvana-go/projects"
)

func main() {
  client := nirvana.NewClient(
    option.WithAPIKey("My API Key"),
  )
  project, err := client.Projects.Update(
    context.TODO(),
    "project_id",
    projects.ProjectUpdateParams{

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

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "name": "My Project",
  "resources": {
    "blockchain": {
      "rpc_nodes_dedicated": 1,
      "rpc_nodes_flex": 3
    },
    "cloud": {
      "connect_connections": 1,
      "nks_clusters": 2,
      "nks_node_pools": 4,
      "vms": 5,
      "volumes": 10,
      "vpcs": 2
    }
  },
  "tags": [
    "production",
    "ethereum"
  ],
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Delete Project

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

**delete** `/v1/projects/{project_id}`

Delete a project

### Parameters

- `projectID string`

### Example

```go
package main

import (
  "context"

  "github.com/nirvana-labs/nirvana-go"
  "github.com/nirvana-labs/nirvana-go/option"
)

func main() {
  client := nirvana.NewClient(
    option.WithAPIKey("My API Key"),
  )
  err := client.Projects.Delete(context.TODO(), "project_id")
  if err != nil {
    panic(err.Error())
  }
}
```

## List Projects

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

**get** `/v1/projects`

List all projects

### Parameters

- `query ProjectListParams`

  - `Cursor param.Field[string]`

    Pagination cursor returned by a previous request

  - `Limit param.Field[int64]`

    Maximum number of items to return

### Returns

- `type Project struct{…}`

  Project response.

  - `ID string`

    Project ID.

  - `CreatedAt Time`

    When the Project was created.

  - `Name string`

    Project name.

  - `Resources ProjectResources`

    Resource counts for the project.

    - `Blockchain ProjectBlockchainResources`

      Blockchain resources.

      - `RPCNodesDedicated int64`

        Number of dedicated RPC nodes in the project.

      - `RPCNodesFlex int64`

        Number of flex RPC nodes in the project.

    - `Cloud ProjectCloudResources`

      Cloud infrastructure resources.

      - `ConnectConnections int64`

        Number of Connect connections in the project.

      - `NKSClusters int64`

        Number of NKS clusters in the project.

      - `NKSNodePools int64`

        Number of NKS node pools in the project.

      - `VMs int64`

        Number of VMs in the project.

      - `Volumes int64`

        Number of volumes in the project.

      - `VPCs int64`

        Number of VPCs in the project.

  - `Tags []string`

    Tags attached to the Project.

  - `UpdatedAt Time`

    When the Project was updated.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/nirvana-labs/nirvana-go"
  "github.com/nirvana-labs/nirvana-go/option"
  "github.com/nirvana-labs/nirvana-go/projects"
)

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

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

#### Response

```json
{
  "items": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "created_at": "2025-01-01T00:00:00Z",
      "name": "My Project",
      "resources": {
        "blockchain": {
          "rpc_nodes_dedicated": 1,
          "rpc_nodes_flex": 3
        },
        "cloud": {
          "connect_connections": 1,
          "nks_clusters": 2,
          "nks_node_pools": 4,
          "vms": 5,
          "volumes": 10,
          "vpcs": 2
        }
      },
      "tags": [
        "production",
        "ethereum"
      ],
      "updated_at": "2025-01-01T00:00:00Z"
    }
  ],
  "pagination": {
    "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
    "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
    "total_count": 125
  }
}
```

## Domain Types

### Project

- `type Project struct{…}`

  Project response.

  - `ID string`

    Project ID.

  - `CreatedAt Time`

    When the Project was created.

  - `Name string`

    Project name.

  - `Resources ProjectResources`

    Resource counts for the project.

    - `Blockchain ProjectBlockchainResources`

      Blockchain resources.

      - `RPCNodesDedicated int64`

        Number of dedicated RPC nodes in the project.

      - `RPCNodesFlex int64`

        Number of flex RPC nodes in the project.

    - `Cloud ProjectCloudResources`

      Cloud infrastructure resources.

      - `ConnectConnections int64`

        Number of Connect connections in the project.

      - `NKSClusters int64`

        Number of NKS clusters in the project.

      - `NKSNodePools int64`

        Number of NKS node pools in the project.

      - `VMs int64`

        Number of VMs in the project.

      - `Volumes int64`

        Number of volumes in the project.

      - `VPCs int64`

        Number of VPCs in the project.

  - `Tags []string`

    Tags attached to the Project.

  - `UpdatedAt Time`

    When the Project was updated.

### Project Blockchain Resources

- `type ProjectBlockchainResources struct{…}`

  Blockchain resources.

  - `RPCNodesDedicated int64`

    Number of dedicated RPC nodes in the project.

  - `RPCNodesFlex int64`

    Number of flex RPC nodes in the project.

### Project Cloud Resources

- `type ProjectCloudResources struct{…}`

  Cloud infrastructure resources.

  - `ConnectConnections int64`

    Number of Connect connections in the project.

  - `NKSClusters int64`

    Number of NKS clusters in the project.

  - `NKSNodePools int64`

    Number of NKS node pools in the project.

  - `VMs int64`

    Number of VMs in the project.

  - `Volumes int64`

    Number of volumes in the project.

  - `VPCs int64`

    Number of VPCs in the project.

### Project List

- `type ProjectList struct{…}`

  - `Items []Project`

    - `ID string`

      Project ID.

    - `CreatedAt Time`

      When the Project was created.

    - `Name string`

      Project name.

    - `Resources ProjectResources`

      Resource counts for the project.

      - `Blockchain ProjectBlockchainResources`

        Blockchain resources.

        - `RPCNodesDedicated int64`

          Number of dedicated RPC nodes in the project.

        - `RPCNodesFlex int64`

          Number of flex RPC nodes in the project.

      - `Cloud ProjectCloudResources`

        Cloud infrastructure resources.

        - `ConnectConnections int64`

          Number of Connect connections in the project.

        - `NKSClusters int64`

          Number of NKS clusters in the project.

        - `NKSNodePools int64`

          Number of NKS node pools in the project.

        - `VMs int64`

          Number of VMs in the project.

        - `Volumes int64`

          Number of volumes in the project.

        - `VPCs int64`

          Number of VPCs in the project.

    - `Tags []string`

      Tags attached to the Project.

    - `UpdatedAt Time`

      When the Project was updated.

  - `Pagination Pagination`

    Pagination response details.

    - `NextCursor string`

    - `PreviousCursor string`

    - `TotalCount int64`

### Project Resources

- `type ProjectResources struct{…}`

  Resource counts for the project.

  - `Blockchain ProjectBlockchainResources`

    Blockchain resources.

    - `RPCNodesDedicated int64`

      Number of dedicated RPC nodes in the project.

    - `RPCNodesFlex int64`

      Number of flex RPC nodes in the project.

  - `Cloud ProjectCloudResources`

    Cloud infrastructure resources.

    - `ConnectConnections int64`

      Number of Connect connections in the project.

    - `NKSClusters int64`

      Number of NKS clusters in the project.

    - `NKSNodePools int64`

      Number of NKS node pools in the project.

    - `VMs int64`

      Number of VMs in the project.

    - `Volumes int64`

      Number of volumes in the project.

    - `VPCs int64`

      Number of VPCs in the project.
