> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ofauth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Go SDK

> Official OFAuth Go SDK — zero dependencies, context-based cancellation, 126+ typed methods

```bash theme={null}
go get github.com/ofauth-org/onlyfans-sdk-go
```

## Quick Example

```go theme={null}
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/ofauth-org/onlyfans-sdk-go"
)

func main() {
    client := ofauth.NewClient("your-api-key")

    acc, err := client.Whoami(context.Background())
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(acc.Id, acc.Permissions)
}
```

## Details

|                  | Go                                                               |
| ---------------- | ---------------------------------------------------------------- |
| **Package**      | `onlyfans-sdk-go`                                                |
| **Repository**   | [onlyfans-sdk-go](https://github.com/OFAuth-org/onlyfans-sdk-go) |
| **Init**         | `ofauth.NewClient()`                                             |
| **Architecture** | 126+ typed methods, builder pattern                              |
| **Types**        | Generated response structs                                       |
| **Pagination**   | Manual (query params)                                            |
| **Dependencies** | Zero (standard library)                                          |

## Features

<CardGroup cols={2}>
  <Card title="Context Cancellation" icon="code">
    Every method accepts `context.Context` for timeouts and cancellation.
  </Card>

  <Card title="Zero Dependencies" icon="box">
    Built entirely on Go's standard library.
  </Card>

  <Card title="Proxy Support" icon="globe">
    Call any OnlyFans endpoint directly through the OFAuth proxy.
  </Card>

  <Card title="Media Upload" icon="cloud-arrow-up">
    Automatic chunking and progress callbacks.
  </Card>
</CardGroup>

## Usage Examples

### List subscribers

```go theme={null}
subs, err := client.ListSubscribers(ctx, &ofauth.ListSubscribersParams{
    ConnectionID: "conn_xxx",
    Limit:        20,
})
if err != nil {
    log.Fatal(err)
}

for _, sub := range subs.Data {
    fmt.Println(sub.Username, sub.SubscribedAt)
}
```

### Send a message

```go theme={null}
err := client.SendMessage(ctx, &ofauth.SendMessageParams{
    ConnectionID: "conn_xxx",
    UserID:       "12345",
    Text:         "Hello from OFAuth!",
})
```

### Error handling

```go theme={null}
_, err := client.GetUser(ctx, &ofauth.GetUserParams{
    ConnectionID: "conn_xxx",
    UserID:       "999",
})
if err != nil {
    var apiErr *ofauth.APIError
    if errors.As(err, &apiErr) {
        fmt.Println(apiErr.Status, apiErr.Code, apiErr.Message)
    }
}
```
