# Flex

## Create RPC Node Flex

`client.RPCNodes.Flex.New(ctx, body) (*Flex, error)`

**post** `/v1/rpc_nodes/flex`

Create a new RPC Node Flex

### Parameters

- `body FlexNewParams`

  - `Blockchain param.Field[string]`

    Blockchain.

  - `Name param.Field[string]`

    Name of the RPC Node Flex.

  - `Network param.Field[string]`

    Network type (e.g., mainnet, testnet).

  - `ProjectID param.Field[string]`

    Project ID to associate with the RPC Node Flex.

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

    Tags to attach to the RPC Node Flex (optional, max 50).

### Returns

- `type Flex struct{…}`

  RPC Node Flex details.

  - `ID string`

    Unique identifier for the RPC Node Flex.

  - `Blockchain string`

    Blockchain type.

  - `CreatedAt Time`

    When the RPC Node Flex was created.

  - `Endpoint string`

    RPC endpoint URL.

  - `Name string`

    Name of the RPC Node Flex.

  - `Network string`

    Network type (e.g., mainnet, testnet).

  - `ProjectID string`

    Project identifier associated with the RPC Node Flex.

  - `Tags []string`

    Tags to attach to the RPC Node Flex.

  - `UpdatedAt Time`

    When the RPC Node Flex 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/rpc_nodes"
)

func main() {
  client := nirvana.NewClient(
    option.WithAPIKey("My API Key"),
  )
  flex, err := client.RPCNodes.Flex.New(context.TODO(), rpc_nodes.FlexNewParams{
    Blockchain: "ethereum",
    Name: "my-ethereum-node",
    Network: "mainnet",
    ProjectID: "123e4567-e89b-12d3-a456-426614174000",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", flex.ID)
}
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "blockchain": "ethereum",
  "created_at": "2025-01-01T00:00:00Z",
  "endpoint": "https://ethereum-mainnet.nirvanalabs.xyz/my-ethereum-node-abc12?apikey=apiKey",
  "name": "my-ethereum-node",
  "network": "mainnet",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "tags": [
    "production",
    "ethereum"
  ],
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Get RPC Node Flex Details

`client.RPCNodes.Flex.Get(ctx, nodeID) (*Flex, error)`

**get** `/v1/rpc_nodes/flex/{node_id}`

Get details about an RPC Node Flex

### Parameters

- `nodeID string`

### Returns

- `type Flex struct{…}`

  RPC Node Flex details.

  - `ID string`

    Unique identifier for the RPC Node Flex.

  - `Blockchain string`

    Blockchain type.

  - `CreatedAt Time`

    When the RPC Node Flex was created.

  - `Endpoint string`

    RPC endpoint URL.

  - `Name string`

    Name of the RPC Node Flex.

  - `Network string`

    Network type (e.g., mainnet, testnet).

  - `ProjectID string`

    Project identifier associated with the RPC Node Flex.

  - `Tags []string`

    Tags to attach to the RPC Node Flex.

  - `UpdatedAt Time`

    When the RPC Node Flex 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"),
  )
  flex, err := client.RPCNodes.Flex.Get(context.TODO(), "node_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", flex.ID)
}
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "blockchain": "ethereum",
  "created_at": "2025-01-01T00:00:00Z",
  "endpoint": "https://ethereum-mainnet.nirvanalabs.xyz/my-ethereum-node-abc12?apikey=apiKey",
  "name": "my-ethereum-node",
  "network": "mainnet",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "tags": [
    "production",
    "ethereum"
  ],
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Update RPC Node Flex

`client.RPCNodes.Flex.Update(ctx, nodeID, body) (*Flex, error)`

**patch** `/v1/rpc_nodes/flex/{node_id}`

Update an existing RPC Node Flex

### Parameters

- `nodeID string`

- `body FlexUpdateParams`

  - `Name param.Field[string]`

    Name of the RPC Node Flex.

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

    Tags to attach to the RPC Node Flex (optional, max 50).

### Returns

- `type Flex struct{…}`

  RPC Node Flex details.

  - `ID string`

    Unique identifier for the RPC Node Flex.

  - `Blockchain string`

    Blockchain type.

  - `CreatedAt Time`

    When the RPC Node Flex was created.

  - `Endpoint string`

    RPC endpoint URL.

  - `Name string`

    Name of the RPC Node Flex.

  - `Network string`

    Network type (e.g., mainnet, testnet).

  - `ProjectID string`

    Project identifier associated with the RPC Node Flex.

  - `Tags []string`

    Tags to attach to the RPC Node Flex.

  - `UpdatedAt Time`

    When the RPC Node Flex 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/rpc_nodes"
)

func main() {
  client := nirvana.NewClient(
    option.WithAPIKey("My API Key"),
  )
  flex, err := client.RPCNodes.Flex.Update(
    context.TODO(),
    "node_id",
    rpc_nodes.FlexUpdateParams{

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

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "blockchain": "ethereum",
  "created_at": "2025-01-01T00:00:00Z",
  "endpoint": "https://ethereum-mainnet.nirvanalabs.xyz/my-ethereum-node-abc12?apikey=apiKey",
  "name": "my-ethereum-node",
  "network": "mainnet",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "tags": [
    "production",
    "ethereum"
  ],
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Delete RPC Node Flex

`client.RPCNodes.Flex.Delete(ctx, nodeID) error`

**delete** `/v1/rpc_nodes/flex/{node_id}`

Delete an RPC Node Flex

### Parameters

- `nodeID 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.RPCNodes.Flex.Delete(context.TODO(), "node_id")
  if err != nil {
    panic(err.Error())
  }
}
```

## List RPC Node Flex

`client.RPCNodes.Flex.List(ctx, query) (*Cursor[Flex], error)`

**get** `/v1/rpc_nodes/flex`

List all RPC Node Flex you created

### Parameters

- `query FlexListParams`

  - `ProjectID param.Field[string]`

    Project ID of resources to request

  - `Cursor param.Field[string]`

    Pagination cursor returned by a previous request

  - `Limit param.Field[int64]`

    Maximum number of items to return

### Returns

- `type Flex struct{…}`

  RPC Node Flex details.

  - `ID string`

    Unique identifier for the RPC Node Flex.

  - `Blockchain string`

    Blockchain type.

  - `CreatedAt Time`

    When the RPC Node Flex was created.

  - `Endpoint string`

    RPC endpoint URL.

  - `Name string`

    Name of the RPC Node Flex.

  - `Network string`

    Network type (e.g., mainnet, testnet).

  - `ProjectID string`

    Project identifier associated with the RPC Node Flex.

  - `Tags []string`

    Tags to attach to the RPC Node Flex.

  - `UpdatedAt Time`

    When the RPC Node Flex 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/rpc_nodes"
)

func main() {
  client := nirvana.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.RPCNodes.Flex.List(context.TODO(), rpc_nodes.FlexListParams{
    ProjectID: "project_id",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
```

#### Response

```json
{
  "items": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "blockchain": "ethereum",
      "created_at": "2025-01-01T00:00:00Z",
      "endpoint": "https://ethereum-mainnet.nirvanalabs.xyz/my-ethereum-node-abc12?apikey=apiKey",
      "name": "my-ethereum-node",
      "network": "mainnet",
      "project_id": "123e4567-e89b-12d3-a456-426614174000",
      "tags": [
        "production",
        "ethereum"
      ],
      "updated_at": "2025-01-01T00:00:00Z"
    }
  ],
  "pagination": {
    "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
    "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
    "total_count": 125
  }
}
```

## Domain Types

### Flex

- `type Flex struct{…}`

  RPC Node Flex details.

  - `ID string`

    Unique identifier for the RPC Node Flex.

  - `Blockchain string`

    Blockchain type.

  - `CreatedAt Time`

    When the RPC Node Flex was created.

  - `Endpoint string`

    RPC endpoint URL.

  - `Name string`

    Name of the RPC Node Flex.

  - `Network string`

    Network type (e.g., mainnet, testnet).

  - `ProjectID string`

    Project identifier associated with the RPC Node Flex.

  - `Tags []string`

    Tags to attach to the RPC Node Flex.

  - `UpdatedAt Time`

    When the RPC Node Flex was updated.

### Flex Blockchain

- `type FlexBlockchain struct{…}`

  Blockchain supported by the RPC Node Flex.

  - `Blockchain string`

    Blockchain type.

  - `Network string`

    Network type (e.g., mainnet, testnet).

### Flex Blockchain List

- `type FlexBlockchainList struct{…}`

  - `Items []FlexBlockchain`

    - `Blockchain string`

      Blockchain type.

    - `Network string`

      Network type (e.g., mainnet, testnet).

  - `Pagination Pagination`

    Pagination response details.

    - `NextCursor string`

    - `PreviousCursor string`

    - `TotalCount int64`

### Flex List

- `type FlexList struct{…}`

  - `Items []Flex`

    - `ID string`

      Unique identifier for the RPC Node Flex.

    - `Blockchain string`

      Blockchain type.

    - `CreatedAt Time`

      When the RPC Node Flex was created.

    - `Endpoint string`

      RPC endpoint URL.

    - `Name string`

      Name of the RPC Node Flex.

    - `Network string`

      Network type (e.g., mainnet, testnet).

    - `ProjectID string`

      Project identifier associated with the RPC Node Flex.

    - `Tags []string`

      Tags to attach to the RPC Node Flex.

    - `UpdatedAt Time`

      When the RPC Node Flex was updated.

  - `Pagination Pagination`

    Pagination response details.

    - `NextCursor string`

    - `PreviousCursor string`

    - `TotalCount int64`

# Blockchains

## List Flex Blockchains

`client.RPCNodes.Flex.Blockchains.List(ctx, query) (*Cursor[FlexBlockchain], error)`

**get** `/v1/rpc_nodes/flex/blockchains`

List all Flex Blockchains

### Parameters

- `query FlexBlockchainListParams`

  - `Cursor param.Field[string]`

    Pagination cursor returned by a previous request

  - `Limit param.Field[int64]`

    Maximum number of items to return

### Returns

- `type FlexBlockchain struct{…}`

  Blockchain supported by the RPC Node Flex.

  - `Blockchain string`

    Blockchain type.

  - `Network string`

    Network type (e.g., mainnet, testnet).

### 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/rpc_nodes"
)

func main() {
  client := nirvana.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.RPCNodes.Flex.Blockchains.List(context.TODO(), rpc_nodes.FlexBlockchainListParams{

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

#### Response

```json
{
  "items": [
    {
      "blockchain": "ethereum",
      "network": "mainnet"
    }
  ],
  "pagination": {
    "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
    "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
    "total_count": 125
  }
}
```
