# Experiences

## List experiences you can invoke

`client.Experiences.List(ctx) (*ExperienceListResponse, error)`

**get** `/v3/experiences`

The experiences enabled for your account, with the actions you may
invoke on each and the fields each action accepts. Treat it as the
list to build against: anything not described here is unsupported and
may change or stop working without notice.

### Returns

- `type ExperienceListResponse struct{…}`

  - `Experiences []ExperienceListResponseExperience`

    - `Actions []ExperienceListResponseExperienceAction`

      - `Fields map[string, ExperienceListResponseExperienceActionField]`

        Fields you may send in `params`, keyed by the exact name to use.

        - `Max int64`

          Maximum length, for strings.

        - `Required bool`

        - `Type string`

          - `const ExperienceListResponseExperienceActionFieldTypeString ExperienceListResponseExperienceActionFieldType = "string"`

          - `const ExperienceListResponseExperienceActionFieldTypeCents ExperienceListResponseExperienceActionFieldType = "cents"`

          - `const ExperienceListResponseExperienceActionFieldTypeInt ExperienceListResponseExperienceActionFieldType = "int"`

          - `const ExperienceListResponseExperienceActionFieldTypeURL ExperienceListResponseExperienceActionFieldType = "url"`

      - `Name string`

      - `Summary string`

    - `DisplayName string`

    - `Experience string`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/linq-team/linq-go"
  "github.com/linq-team/linq-go/option"
)

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  experiences, err := client.Experiences.List(context.TODO())
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", experiences.Experiences)
}
```

#### Response

```json
{
  "experiences": [
    {
      "experience": "agentpay",
      "display_name": "Agent Pay",
      "actions": [
        {
          "name": "request_payment",
          "summary": "Ask the customer to pay a payment request.",
          "fields": {
            "checkout_url": {
              "type": "url",
              "required": true
            },
            "title": {
              "type": "string",
              "max": 64,
              "required": false
            },
            "note": {
              "type": "string",
              "max": 120,
              "required": false
            }
          }
        }
      ]
    },
    {
      "experience": "agentcard",
      "display_name": "Agentcard",
      "actions": [
        {
          "name": "attach_card",
          "summary": "Ask the customer to add a card to their wallet.",
          "fields": {
            "title": {
              "type": "string",
              "max": 64,
              "required": false
            },
            "subtitle": {
              "type": "string",
              "max": 120,
              "required": false
            },
            "button": {
              "type": "string",
              "max": 24,
              "required": false
            }
          }
        }
      ]
    },
    {
      "experience": "link",
      "display_name": "Link",
      "actions": [
        {
          "name": "open",
          "summary": "Ask the recipient to open a link.",
          "fields": {
            "url": {
              "type": "url",
              "max": 2048,
              "required": true
            },
            "title": {
              "type": "string",
              "max": 64,
              "required": false
            }
          }
        }
      ]
    }
  ]
}
```

## Get one experience

`client.Experiences.Get(ctx, experience) (*ExperienceGetResponse, error)`

**get** `/v3/experiences/{experience}`

Get one experience

### Parameters

- `experience string`

### Returns

- `type ExperienceGetResponse struct{…}`

  What an experience offers you. Deliberately a projection: where its
  templates live and how they are built is not yours to depend on, so it
  is not here.

  - `Actions []ExperienceGetResponseAction`

    - `Fields map[string, ExperienceGetResponseActionField]`

      Fields you may send in `params`, keyed by the exact name to use.

      - `Max int64`

        Maximum length, for strings.

      - `Required bool`

      - `Type string`

        - `const ExperienceGetResponseActionFieldTypeString ExperienceGetResponseActionFieldType = "string"`

        - `const ExperienceGetResponseActionFieldTypeCents ExperienceGetResponseActionFieldType = "cents"`

        - `const ExperienceGetResponseActionFieldTypeInt ExperienceGetResponseActionFieldType = "int"`

        - `const ExperienceGetResponseActionFieldTypeURL ExperienceGetResponseActionFieldType = "url"`

    - `Name string`

    - `Summary string`

  - `DisplayName string`

  - `Experience string`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/linq-team/linq-go"
  "github.com/linq-team/linq-go/option"
)

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  experience, err := client.Experiences.Get(context.TODO(), "agentpay")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", experience.Actions)
}
```

#### Response

```json
{
  "experience": "agentpay",
  "display_name": "Agent Pay",
  "actions": [
    {
      "name": "request_payment",
      "summary": "Ask the customer to pay a payment request.",
      "fields": {
        "checkout_url": {
          "type": "url",
          "required": true
        },
        "title": {
          "type": "string",
          "max": 64,
          "required": false
        },
        "note": {
          "type": "string",
          "max": 120,
          "required": false
        }
      }
    }
  ]
}
```
