npm package: @rainfall-digital/sdk
Description: Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@rainfall-digital/sdk* API.
Author: Speakeasy
Latest version: 0.2.2

# @rainfall-digital/sdk

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@rainfall-digital/sdk* API.

[![Built by Speakeasy](https://img.shields.io/badge/Built_by-SPEAKEASY-374151?style=for-the-badge&labelColor=f3f4f6)](https://www.speakeasy.com/?utm_source=@rainfall-digital/sdk&utm_campaign=typescript)
[![License: MIT](https://img.shields.io/badge/LICENSE_//_MIT-3b5bdb?style=for-the-badge&labelColor=eff6ff)](https://opensource.org/licenses/MIT)



<!-- Start Summary [summary] -->
## Summary

Rainfall Digital API: The Rainfall Digital API empowers developers to seamlessly integrate with our robust
platform, offering a comprehensive suite of endpoints for managing digital assets,
product lines, and user authentication.

### URL Context Requirements
- Public URL endpoints can be called from the base public domain.
- Merchant-specific endpoints must be called from your organization-specific URL
    (for example: yourcompany.rainf4ll.com).
- Merchant-specific endpoints return a `422 invalid_merchant` error when called
    from the public domain.

Key Features:
- Asset Management: Create, retrieve, and transfer digital assets with ease.
- Product Line Operations: Manage product lines and associated products efficiently.
- User Authentication: Secure token-based authentication system with magic link support.
- Event Tracking: Monitor and manage product-related events.
- Merchant Integration: Access merchant details and interact with merchant functionalities.
- Image Handling: Upload and manage images associated with products and assets.

Our API adheres to RESTful principles, ensuring intuitive interaction and seamless
integration with your existing systems. With robust error handling and comprehensive
documentation, we provide a developer-friendly experience fo you to take advantage of.

### References
[ReDoc](/api/schema/redoc)

[Schema Docs](/api/schema/docs)

[Schema Download](/api/schema)

[Privacy Policy](/privacy)
<!-- End Summary [summary] -->

<!-- Start Table of Contents [toc] -->
## Table of Contents
<!-- $toc-max-depth=2 -->
* [@rainfall-digital/sdk](#rainfall-digitalsdk)
  * [SDK Installation](#sdk-installation)
  * [Requirements](#requirements)
  * [SDK Example Usage](#sdk-example-usage)
  * [Authentication](#authentication)
  * [Available Resources and Operations](#available-resources-and-operations)
  * [Standalone functions](#standalone-functions)
  * [File uploads](#file-uploads)
  * [Retries](#retries)
  * [Error Handling](#error-handling)
  * [Server Selection](#server-selection)
  * [Custom HTTP Client](#custom-http-client)
  * [Debugging](#debugging)
* [Development](#development)
  * [Maturity](#maturity)
  * [Contributions](#contributions)

<!-- End Table of Contents [toc] -->

<!-- Start SDK Installation [installation] -->
## SDK Installation

The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.

### NPM

```bash
npm add @rainfall-digital/sdk
```

### PNPM

```bash
pnpm add @rainfall-digital/sdk
```

### Bun

```bash
bun add @rainfall-digital/sdk
```

### Yarn

```bash
yarn add @rainfall-digital/sdk
```

> [!NOTE]
> This package is published with CommonJS and ES Modules (ESM) support.
<!-- End SDK Installation [installation] -->

<!-- Start Requirements [requirements] -->
## Requirements

For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
<!-- End Requirements [requirements] -->

<!-- Start SDK Example Usage [usage] -->
## SDK Example Usage

### Example

```typescript
import { Rainfall } from "@rainfall-digital/sdk";

const rainfall = new Rainfall();

async function run() {
  const result = await rainfall.assets.list({
    tokenAuth: process.env["RAINFALL_TOKEN_AUTH"] ?? "",
  });

  console.log(result);
}

run();

```
<!-- End SDK Example Usage [usage] -->

<!-- Start Authentication [security] -->
## Authentication

### Per-Client Security Schemes

This SDK supports the following security scheme globally:

| Name        | Type   | Scheme  | Environment Variable  |
| ----------- | ------ | ------- | --------------------- |
| `tokenAuth` | apiKey | API key | `RAINFALL_TOKEN_AUTH` |

To authenticate with the API the `tokenAuth` parameter must be set when initializing the SDK client instance. For example:
```typescript
import { Rainfall } from "@rainfall-digital/sdk";

const rainfall = new Rainfall({
  tokenAuth: process.env["RAINFALL_TOKEN_AUTH"] ?? "",
});

async function run() {
  const result = await rainfall.general.refreshToken({
    refresh: "<value>",
  });

  console.log(result);
}

run();

```

### Per-Operation Security Schemes

Some operations in this SDK require the security scheme to be specified at the request level. For example:
```typescript
import { Rainfall } from "@rainfall-digital/sdk";

const rainfall = new Rainfall();

async function run() {
  const result = await rainfall.assets.list({});

  console.log(result);
}

run();

```
<!-- End Authentication [security] -->

<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations

<details open>
<summary>Available methods</summary>

### [Assets](docs/sdks/assets/README.md)

* [list](docs/sdks/assets/README.md#list) - Get assets
* [create](docs/sdks/assets/README.md#create) - Create an asset
* [get](docs/sdks/assets/README.md#get) - Get asset
* [claim](docs/sdks/assets/README.md#claim) - Claim asset
* [createEvent](docs/sdks/assets/README.md#createevent) - Create event
* [setImage](docs/sdks/assets/README.md#setimage) - Set image
* [search](docs/sdks/assets/README.md#search) - Search asset

### [General](docs/sdks/general/README.md)

* [login](docs/sdks/general/README.md#login) - Login to your account
* [logout](docs/sdks/general/README.md#logout) - Logout from your account
* [authLogout](docs/sdks/general/README.md#authlogout) - Logout from your account
* [refreshToken](docs/sdks/general/README.md#refreshtoken) - Takes a refresh type JSON web token and returns an access type JSON web
token if the refresh token is valid.
* [authTokenVerify](docs/sdks/general/README.md#authtokenverify) - Verify JWT access token

### [MagicLink](docs/sdks/magiclink/README.md)

* [request](docs/sdks/magiclink/README.md#request) - Request magic link
* [validate](docs/sdks/magiclink/README.md#validate) - Validate magic link

### [Media](docs/sdks/media/README.md)

* [create](docs/sdks/media/README.md#create) - Create an image

### [Merchants](docs/sdks/merchants/README.md)

* [get](docs/sdks/merchants/README.md#get) - Get merchant

### [Password](docs/sdks/password/README.md)

* [change](docs/sdks/password/README.md#change) - Change your password
* [reset](docs/sdks/password/README.md#reset) - Reset your password
* [resetConfirm](docs/sdks/password/README.md#resetconfirm) - Confirm password reset

### [ProductEvents](docs/sdks/productevents/README.md)

* [list](docs/sdks/productevents/README.md#list) - Get events
* [get](docs/sdks/productevents/README.md#get) - Get event

### [ProductLines](docs/sdks/productlines/README.md)

* [list](docs/sdks/productlines/README.md#list) - Get product lines
* [get](docs/sdks/productlines/README.md#get) - Get product line
* [assignProvisionalProducts](docs/sdks/productlines/README.md#assignprovisionalproducts) - Assign provisional products

### [Products](docs/sdks/products/README.md)

* [get](docs/sdks/products/README.md#get) - Get products
* [fetchById](docs/sdks/products/README.md#fetchbyid) - Get product
* [createEvent](docs/sdks/products/README.md#createevent) - Create product event

### [ProvisionalLines](docs/sdks/provisionallines/README.md)

* [list](docs/sdks/provisionallines/README.md#list) - List provisional lines
* [create](docs/sdks/provisionallines/README.md#create) - Create Provisional Line
* [createProducts](docs/sdks/provisionallines/README.md#createproducts) - Create additional provisional products
* [listProducts](docs/sdks/provisionallines/README.md#listproducts) - List products from a provisional line

### [~~ProvisionalProducts~~](docs/sdks/provisionalproducts/README.md)

* [~~get~~](docs/sdks/provisionalproducts/README.md#get) - List all provisional products :warning: **Deprecated**

### [Registration](docs/sdks/registration/README.md)

* [create](docs/sdks/registration/README.md#create) - Register a new user
* [resendEmailVerification](docs/sdks/registration/README.md#resendemailverification) - Resend email verification
* [verifyEmail](docs/sdks/registration/README.md#verifyemail) - Verify email address

### [Settings](docs/sdks/settings/README.md)

* [getPersonalAssets](docs/sdks/settings/README.md#getpersonalassets) - Get Asset Settings
* [updatePersonalAssets](docs/sdks/settings/README.md#updatepersonalassets) - Set Asset Settings
* [updateAsset](docs/sdks/settings/README.md#updateasset) - Update Asset Setting

### [SharedEvents](docs/sdks/sharedevents/README.md)

* [list](docs/sdks/sharedevents/README.md#list) - List shared events
* [create](docs/sdks/sharedevents/README.md#create) - Create shared event
* [get](docs/sdks/sharedevents/README.md#get) - Get shared event
* [update](docs/sdks/sharedevents/README.md#update) - Update shared event
* [patch](docs/sdks/sharedevents/README.md#patch) - Partially update shared event
* [delete](docs/sdks/sharedevents/README.md#delete) - Delete shared event

### [Transfers](docs/sdks/transfers/README.md)

* [list](docs/sdks/transfers/README.md#list) - Get transfers
* [create](docs/sdks/transfers/README.md#create) - Create transfer
* [get](docs/sdks/transfers/README.md#get) - Get transfer
* [partialUpdate](docs/sdks/transfers/README.md#partialupdate) - Update expiration
* [delete](docs/sdks/transfers/README.md#delete) - Delete transfer
* [acceptRequest](docs/sdks/transfers/README.md#acceptrequest) - Accept transfer
* [rejectRequest](docs/sdks/transfers/README.md#rejectrequest) - Reject transfer
* [getIncomingTransferCount](docs/sdks/transfers/README.md#getincomingtransfercount) - Incoming transfer count

### [UserProfile](docs/sdks/userprofile/README.md)

* [get](docs/sdks/userprofile/README.md#get) - Retrieve user details
* [update](docs/sdks/userprofile/README.md#update) - Update user details
* [partialUpdate](docs/sdks/userprofile/README.md#partialupdate) - Partially update user details

### [Webhooks](docs/sdks/webhooks/README.md)

* [createTwilioEvent](docs/sdks/webhooks/README.md#createtwilioevent) - Process SMS messages from Twilio to create product events.

This webhook endpoint receives SMS messages from Twilio and processes them
to create product events. It validates the asset serial number, checks if
the phone number is associated with the correct merchant, and generates
a magic link for event submission.

Args:
    request: The HTTP request containing Twilio's webhook payload.

Returns:
    Response: A response with appropriate message and HTTP 200 OK status.

</details>
<!-- End Available Resources and Operations [operations] -->

<!-- Start Standalone functions [standalone-funcs] -->
## Standalone functions

All the methods listed above are available as standalone functions. These
functions are ideal for use in applications running in the browser, serverless
runtimes or other environments where application bundle size is a primary
concern. When using a bundler to build your application, all unused
functionality will be either excluded from the final bundle or tree-shaken away.

To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).

<details>

<summary>Available standalone functions</summary>

- [`assetsClaim`](docs/sdks/assets/README.md#claim) - Claim asset
- [`assetsCreate`](docs/sdks/assets/README.md#create) - Create an asset
- [`assetsCreateEvent`](docs/sdks/assets/README.md#createevent) - Create event
- [`assetsGet`](docs/sdks/assets/README.md#get) - Get asset
- [`assetsList`](docs/sdks/assets/README.md#list) - Get assets
- [`assetsSearch`](docs/sdks/assets/README.md#search) - Search asset
- [`assetsSetImage`](docs/sdks/assets/README.md#setimage) - Set image
- [`generalAuthLogout`](docs/sdks/general/README.md#authlogout) - Logout from your account
- [`generalAuthTokenVerify`](docs/sdks/general/README.md#authtokenverify) - Verify JWT access token
- [`generalLogin`](docs/sdks/general/README.md#login) - Login to your account
- [`generalLogout`](docs/sdks/general/README.md#logout) - Logout from your account
- [`generalRefreshToken`](docs/sdks/general/README.md#refreshtoken) - Takes a refresh type JSON web token and returns an access type JSON web
token if the refresh token is valid.
- [`magicLinkRequest`](docs/sdks/magiclink/README.md#request) - Request magic link
- [`magicLinkValidate`](docs/sdks/magiclink/README.md#validate) - Validate magic link
- [`mediaCreate`](docs/sdks/media/README.md#create) - Create an image
- [`merchantsGet`](docs/sdks/merchants/README.md#get) - Get merchant
- [`passwordChange`](docs/sdks/password/README.md#change) - Change your password
- [`passwordReset`](docs/sdks/password/README.md#reset) - Reset your password
- [`passwordResetConfirm`](docs/sdks/password/README.md#resetconfirm) - Confirm password reset
- [`productEventsGet`](docs/sdks/productevents/README.md#get) - Get event
- [`productEventsList`](docs/sdks/productevents/README.md#list) - Get events
- [`productLinesAssignProvisionalProducts`](docs/sdks/productlines/README.md#assignprovisionalproducts) - Assign provisional products
- [`productLinesGet`](docs/sdks/productlines/README.md#get) - Get product line
- [`productLinesList`](docs/sdks/productlines/README.md#list) - Get product lines
- [`productsCreateEvent`](docs/sdks/products/README.md#createevent) - Create product event
- [`productsFetchById`](docs/sdks/products/README.md#fetchbyid) - Get product
- [`productsGet`](docs/sdks/products/README.md#get) - Get products
- [`provisionalLinesCreate`](docs/sdks/provisionallines/README.md#create) - Create Provisional Line
- [`provisionalLinesCreateProducts`](docs/sdks/provisionallines/README.md#createproducts) - Create additional provisional products
- [`provisionalLinesList`](docs/sdks/provisionallines/README.md#list) - List provisional lines
- [`provisionalLinesListProducts`](docs/sdks/provisionallines/README.md#listproducts) - List products from a provisional line
- [`registrationCreate`](docs/sdks/registration/README.md#create) - Register a new user
- [`registrationResendEmailVerification`](docs/sdks/registration/README.md#resendemailverification) - Resend email verification
- [`registrationVerifyEmail`](docs/sdks/registration/README.md#verifyemail) - Verify email address
- [`settingsGetPersonalAssets`](docs/sdks/settings/README.md#getpersonalassets) - Get Asset Settings
- [`settingsUpdateAsset`](docs/sdks/settings/README.md#updateasset) - Update Asset Setting
- [`settingsUpdatePersonalAssets`](docs/sdks/settings/README.md#updatepersonalassets) - Set Asset Settings
- [`sharedEventsCreate`](docs/sdks/sharedevents/README.md#create) - Create shared event
- [`sharedEventsDelete`](docs/sdks/sharedevents/README.md#delete) - Delete shared event
- [`sharedEventsGet`](docs/sdks/sharedevents/README.md#get) - Get shared event
- [`sharedEventsList`](docs/sdks/sharedevents/README.md#list) - List shared events
- [`sharedEventsPatch`](docs/sdks/sharedevents/README.md#patch) - Partially update shared event
- [`sharedEventsUpdate`](docs/sdks/sharedevents/README.md#update) - Update shared event
- [`transfersAcceptRequest`](docs/sdks/transfers/README.md#acceptrequest) - Accept transfer
- [`transfersCreate`](docs/sdks/transfers/README.md#create) - Create transfer
- [`transfersDelete`](docs/sdks/transfers/README.md#delete) - Delete transfer
- [`transfersGet`](docs/sdks/transfers/README.md#get) - Get transfer
- [`transfersGetIncomingTransferCount`](docs/sdks/transfers/README.md#getincomingtransfercount) - Incoming transfer count
- [`transfersList`](docs/sdks/transfers/README.md#list) - Get transfers
- [`transfersPartialUpdate`](docs/sdks/transfers/README.md#partialupdate) - Update expiration
- [`transfersRejectRequest`](docs/sdks/transfers/README.md#rejectrequest) - Reject transfer
- [`userProfileGet`](docs/sdks/userprofile/README.md#get) - Retrieve user details
- [`userProfilePartialUpdate`](docs/sdks/userprofile/README.md#partialupdate) - Partially update user details
- [`userProfileUpdate`](docs/sdks/userprofile/README.md#update) - Update user details
- [`webhooksCreateTwilioEvent`](docs/sdks/webhooks/README.md#createtwilioevent) - Process SMS messages from Twilio to create product events.

This webhook endpoint receives SMS messages from Twilio and processes them
to create product events. It validates the asset serial number, checks if
the phone number is associated with the correct merchant, and generates
a magic link for event submission.

Args:
    request: The HTTP request containing Twilio's webhook payload.

Returns:
    Response: A response with appropriate message and HTTP 200 OK status.
- ~~[`provisionalProductsGet`](docs/sdks/provisionalproducts/README.md#get)~~ - List all provisional products :warning: **Deprecated**

</details>
<!-- End Standalone functions [standalone-funcs] -->

<!-- Start File uploads [file-upload] -->
## File uploads

Certain SDK methods accept files as part of a multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.

> [!TIP]
>
> Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
>
> - **Node.js v20+:** Since v20, Node.js comes with a native `openAsBlob` function in [`node:fs`](https://nodejs.org/docs/latest-v20.x/api/fs.html#fsopenasblobpath-options).
> - **Bun:** The native [`Bun.file`](https://bun.sh/docs/api/file-io#reading-files-bun-file) function produces a file handle that can be used for streaming file uploads.
> - **Browsers:** All supported browsers return an instance to a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) when reading the value from an `<input type="file">` element.
> - **Node.js v18:** A file stream can be created using the `fileFrom` helper from [`fetch-blob/from.js`](https://www.npmjs.com/package/fetch-blob).

```typescript
import { Rainfall } from "@rainfall-digital/sdk";

const rainfall = new Rainfall();

async function run() {
  const result = await rainfall.assets.createEvent({
    tokenAuth: process.env["RAINFALL_TOKEN_AUTH"] ?? "",
  }, {
    id: "5872ea1e-7961-4d8f-a867-b0544ad12777",
    body: {
      title: "<value>",
      date: new Date("2024-12-19T23:26:41.981Z"),
    },
  });

  console.log(result);
}

run();

```
<!-- End File uploads [file-upload] -->

<!-- Start Retries [retries] -->
## Retries

Some of the endpoints in this SDK support retries.  If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API.  However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
```typescript
import { Rainfall } from "@rainfall-digital/sdk";

const rainfall = new Rainfall();

async function run() {
  const result = await rainfall.assets.list(
    {
      tokenAuth: process.env["RAINFALL_TOKEN_AUTH"] ?? "",
    },
    undefined,
    {
      retries: {
        strategy: "backoff",
        backoff: {
          initialInterval: 1,
          maxInterval: 50,
          exponent: 1.1,
          maxElapsedTime: 100,
        },
        retryConnectionErrors: false,
      },
    },
  );

  console.log(result);
}

run();

```

If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
```typescript
import { Rainfall } from "@rainfall-digital/sdk";

const rainfall = new Rainfall({
  retryConfig: {
    strategy: "backoff",
    backoff: {
      initialInterval: 1,
      maxInterval: 50,
      exponent: 1.1,
      maxElapsedTime: 100,
    },
    retryConnectionErrors: false,
  },
});

async function run() {
  const result = await rainfall.assets.list({
    tokenAuth: process.env["RAINFALL_TOKEN_AUTH"] ?? "",
  });

  console.log(result);
}

run();

```
<!-- End Retries [retries] -->

<!-- Start Error Handling [errors] -->
## Error Handling

[`RainfallError`](./src/models/errors/rainfall-error.ts) is the base class for all HTTP error responses. It has the following properties:

| Property            | Type       | Description                                                                             |
| ------------------- | ---------- | --------------------------------------------------------------------------------------- |
| `error.message`     | `string`   | Error message                                                                           |
| `error.statusCode`  | `number`   | HTTP response status code eg `404`                                                      |
| `error.headers`     | `Headers`  | HTTP response headers                                                                   |
| `error.body`        | `string`   | HTTP body. Can be empty string if no body is returned.                                  |
| `error.rawResponse` | `Response` | Raw HTTP response                                                                       |
| `error.data$`       |            | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |

### Example
```typescript
import { Rainfall } from "@rainfall-digital/sdk";
import * as errors from "@rainfall-digital/sdk/models/errors";

const rainfall = new Rainfall();

async function run() {
  try {
    const result = await rainfall.assets.list({
      tokenAuth: process.env["RAINFALL_TOKEN_AUTH"] ?? "",
    });

    console.log(result);
  } catch (error) {
    // The base class for HTTP error responses
    if (error instanceof errors.RainfallError) {
      console.log(error.message);
      console.log(error.statusCode);
      console.log(error.body);
      console.log(error.headers);

      // Depending on the method different errors may be thrown
      if (error instanceof errors.ParseErrorResponse) {
        console.log(error.data$.type); // models.string
        console.log(error.data$.errors); // ParseError[]
      }
    }
  }
}

run();

```

### Error Classes
**Primary errors:**
* [`RainfallError`](./src/models/errors/rainfall-error.ts): The base class for HTTP error responses.
  * [`ErrorResponse405`](./src/models/errors/error-response405.ts): . Status code `405`.
  * [`ErrorResponse406`](./src/models/errors/error-response406.ts): . Status code `406`.
  * [`ErrorResponse415`](./src/models/errors/error-response415.ts): . Status code `415`.
  * [`ErrorResponse500`](./src/models/errors/error-response500.ts): . Status code `500`.
  * [`ParseErrorResponse`](./src/models/errors/parse-error-response.ts): . Status code `400`. *
  * [`ErrorResponse401`](./src/models/errors/error-response401.ts): . Status code `401`. *

<details><summary>Less common errors (40)</summary>

<br />

**Network errors:**
* [`ConnectionError`](./src/models/errors/http-client-errors.ts): HTTP client was unable to make a request to a server.
* [`RequestTimeoutError`](./src/models/errors/http-client-errors.ts): HTTP request timed out due to an AbortSignal signal.
* [`RequestAbortedError`](./src/models/errors/http-client-errors.ts): HTTP request was aborted by the client.
* [`InvalidRequestError`](./src/models/errors/http-client-errors.ts): Any input used to create a request is invalid.
* [`UnexpectedClientError`](./src/models/errors/http-client-errors.ts): Unrecognised or unexpected error.


**Inherit from [`RainfallError`](./src/models/errors/rainfall-error.ts)**:
* [`ErrorResponse404`](./src/models/errors/error-response404.ts): . Status code `404`. Applicable to 21 of 56 methods.*
* [`ErrorResponse403`](./src/models/errors/error-response403.ts): . Status code `403`. Applicable to 7 of 56 methods.*
* [`AssetsCreateValidationError`](./src/models/errors/assets-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthLoginCreateValidationError`](./src/models/errors/auth-login-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthLogoutCreateValidationError`](./src/models/errors/auth-logout-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthTokenRefreshCreateValidationError`](./src/models/errors/auth-token-refresh-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthTokenVerifyCreateValidationError`](./src/models/errors/auth-token-verify-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthMagicLinkCreateValidationError`](./src/models/errors/auth-magic-link-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthMagicLinkValidateCreateValidationError`](./src/models/errors/auth-magic-link-validate-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthPasswordChangeCreateValidationError`](./src/models/errors/auth-password-change-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthPasswordResetCreateValidationError`](./src/models/errors/auth-password-reset-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthPasswordResetConfirmCreateValidationError`](./src/models/errors/auth-password-reset-confirm-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthRegistrationCreateValidationError`](./src/models/errors/auth-registration-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthRegistrationResendEmailCreateValidationError`](./src/models/errors/auth-registration-resend-email-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthRegistrationVerifyEmailCreateValidationError`](./src/models/errors/auth-registration-verify-email-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthUserUpdateValidationError`](./src/models/errors/auth-user-update-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`AuthUserPartialUpdateValidationError`](./src/models/errors/auth-user-partial-update-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`ImageCreateValidationError`](./src/models/errors/image-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`ProductEventsListValidationError`](./src/models/errors/product-events-list-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`GetProductsValidationError`](./src/models/errors/get-products-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`CreateProvisionalLineValidationError`](./src/models/errors/create-provisional-line-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`GetProvisionalProductsValidationError`](./src/models/errors/get-provisional-products-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`SettingsPersonalAssetsUpdateValidationError`](./src/models/errors/settings-personal-assets-update-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`SettingsPersonalAssetsPartialUpdateValidationError`](./src/models/errors/settings-personal-assets-partial-update-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`SharedEventsListValidationError`](./src/models/errors/shared-events-list-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`SharedEventsCreateValidationError`](./src/models/errors/shared-events-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`SharedEventsUpdateValidationError`](./src/models/errors/shared-events-update-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`SharedEventsPartialUpdateValidationError`](./src/models/errors/shared-events-partial-update-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`TransfersListValidationError`](./src/models/errors/transfers-list-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`TransfersCreateValidationError`](./src/models/errors/transfers-create-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`TransfersPartialUpdateValidationError`](./src/models/errors/transfers-partial-update-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`TransfersRequestUpdateValidationError`](./src/models/errors/transfers-request-update-validation-error.ts): . Status code `400`. Applicable to 1 of 56 methods.*
* [`Exception`](./src/models/errors/exception.ts): . Status code `401`. Applicable to 1 of 56 methods.*
* [`ErrorResponse429`](./src/models/errors/error-response429.ts): . Status code `429`. Applicable to 1 of 56 methods.*
* [`ResponseValidationError`](./src/models/errors/response-validation-error.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.

</details>

\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
<!-- End Error Handling [errors] -->

<!-- Start Server Selection [server] -->
## Server Selection

### Override Server URL Per-Client

The default server can be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
```typescript
import { Rainfall } from "@rainfall-digital/sdk";

const rainfall = new Rainfall({
  serverURL: "https://rainf4ll.com",
});

async function run() {
  const result = await rainfall.assets.list({
    tokenAuth: process.env["RAINFALL_TOKEN_AUTH"] ?? "",
  });

  console.log(result);
}

run();

```
<!-- End Server Selection [server] -->

<!-- Start Custom HTTP Client [http-client] -->
## Custom HTTP Client

The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
client is a thin wrapper around `fetch` and provides the ability to attach hooks
around the request lifecycle that can be used to modify the request or handle
errors and response.

The `HTTPClient` constructor takes an optional `fetcher` argument that can be
used to integrate a third-party HTTP client or when writing tests to mock out
the HTTP client and feed in fixtures.

The following example shows how to:
- route requests through a proxy server using [undici](https://www.npmjs.com/package/undici)'s ProxyAgent
- use the `"beforeRequest"` hook to add a custom header and a timeout to requests
- use the `"requestError"` hook to log errors

```typescript
import { Rainfall } from "@rainfall-digital/sdk";
import { ProxyAgent } from "undici";
import { HTTPClient } from "@rainfall-digital/sdk/lib/http";

const dispatcher = new ProxyAgent("http://proxy.example.com:8080");

const httpClient = new HTTPClient({
  // 'fetcher' takes a function that has the same signature as native 'fetch'.
  fetcher: (input, init) =>
    // 'dispatcher' is specific to undici and not part of the standard Fetch API.
    fetch(input, { ...init, dispatcher } as RequestInit),
});

httpClient.addHook("beforeRequest", (request) => {
  const nextRequest = new Request(request, {
    signal: request.signal || AbortSignal.timeout(5000)
  });

  nextRequest.headers.set("x-custom-header", "custom value");

  return nextRequest;
});

httpClient.addHook("requestError", (error, request) => {
  console.group("Request Error");
  console.log("Reason:", `${error}`);
  console.log("Endpoint:", `${request.method} ${request.url}`);
  console.groupEnd();
});

const sdk = new Rainfall({ httpClient: httpClient });
```
<!-- End Custom HTTP Client [http-client] -->

<!-- Start Debugging [debug] -->
## Debugging

You can setup your SDK to emit debug logs for SDK requests and responses.

You can pass a logger that matches `console`'s interface as an SDK option.

> [!WARNING]
> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.

```typescript
import { Rainfall } from "@rainfall-digital/sdk";

const sdk = new Rainfall({ debugLogger: console });
```

You can also enable a default debug logger by setting an environment variable `RAINFALL_DEBUG` to true.
<!-- End Debugging [debug] -->

<!-- Placeholder for Future Speakeasy SDK Sections -->

# Development

## Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
looking for the latest version.

## Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. 
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release. 

### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=@rainfall-digital/sdk&utm_campaign=typescript)