# .NET SDK

.NET 8 or .NET 10, base class library only.

## Install

```sh
dotnet add package OhAuthCat --version 0.0.2
```

- Create a client: `new OhAuthCatClient(new OhAuthCatOptions { ApiKey = ..., ClientId = "pk_..." })`. It is disposable.
- Call any API operation, for example `await client.Organizations.GetOrganizationAsync("org_...")`, or `await foreach` over `ListDirectoryUsersAutoPagingAsync(...)`.
- SSO: `client.SsoHelpers.GetAuthorizationUrl(new AuthorizationOptions { RedirectUri = ..., Domain = ... })` returns `Url` and `CodeVerifier`; then `await client.SsoHelpers.GetProfileAndTokenAsync(code, verifier, redirectUri)`.
- Webhooks: `Webhooks.Verify(rawBody, request.Headers["OhAuthCat-Signature"], secret)`.
- Errors are `OhAuthCatException` subclasses, such as `NotFoundException` and `RateLimitedException`, with the stable `Code`.
- Set your own idempotency key with `RequestOptions.IdempotencyKey`.
