# Invites

## List Invites

`client.Invites.ListMine(ctx, query) (*PaginatedCursor[Invite], error)`

**get** `/api/v2/invites`

List the current user's pending invitations, cursor-paginated.

### Parameters

- `query InviteListMineParams`

  - `PageSize param.Field[int64]`

  - `PageToken param.Field[string]`

### Returns

- `type Invite struct{…}`

  A pending invitation visible to the invitee.

  - `ID string`

    The invite's unique identifier.

  - `OrganizationID string`

    The organization the user is invited to.

  - `OrganizationName string`

    The organization's display name.

  - `Role string`

    The role being granted (e.g. admin, viewer).

  - `CreatedAt Time`

    Creation datetime

  - `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.Invites.ListMine(context.TODO(), llamacloudadmin.InviteListMineParams{

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

#### Response

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

## Decline Invite

`client.Invites.Decline(ctx, inviteID) error`

**delete** `/api/v2/invites/{invite_id}`

Decline a pending invitation.

### Parameters

- `inviteID 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.Invites.Decline(context.TODO(), "invite_id")
  if err != nil {
    panic(err.Error())
  }
}
```

## Accept Invite

`client.Invites.Accept(ctx, inviteID) (*InviteAcceptResponse, error)`

**post** `/api/v2/invites/{invite_id}/accept`

Accept a pending invitation. Returns the joined organization id.

### Parameters

- `inviteID string`

### Returns

- `type InviteAcceptResponse struct{…}`

  Response for accepting an invitation.

  - `OrganizationID string`

    The organization the user just joined.

### 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"),
  )
  response, err := client.Invites.Accept(context.TODO(), "invite_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.OrganizationID)
}
```

#### Response

```json
{
  "organization_id": "organization_id"
}
```

## Domain Types

### Invite

- `type Invite struct{…}`

  A pending invitation visible to the invitee.

  - `ID string`

    The invite's unique identifier.

  - `OrganizationID string`

    The organization the user is invited to.

  - `OrganizationName string`

    The organization's display name.

  - `Role string`

    The role being granted (e.g. admin, viewer).

  - `CreatedAt Time`

    Creation datetime

  - `UpdatedAt Time`

    Update datetime
