# Metroplex TypeScript Bindings 

Metroplex TypeScript Bindings is a library providing TypeScript typings for clients interacting with the Metroplex Rust service. It simplifies development by ensuring strong type support for the Metroplex API and websocket connections.

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
  - [Endpoints](#endpoints)
    - [POST Endpoints](#post-endpoints)
    - [WebSocket Endpoint](#websocket-endpoint)
- [Contributing](#contributing)
- [License](#license)
- [Links](#links)

## Installation

Install the package using npm:

```bash
npm install @noibu/metroplex-ts-bindings
```

or with yarn:

```bash
yarn add @noibu/metroplex-ts-bindings
```

## Usage

This package provides TypeScript typings for Metroplex endpoints. To use them:

1. Create or edit any `.d.ts` file and add:
   ```typescript
   import "@noibu/metroplex-ts-bindings";
   ```
2. Update your tsconfig.json to include the .d.ts file:
   ```json
   {
     "include": ["path/to/your/file.d.ts"]
   }
   ```

### Endpoints
#### POST Endpoints

These endpoints accept POST requests and require specific payloads:

- **Collect Error** (`CollectError.d.ts`):
  Typings for submitting error data.

- **Metrics** (`PageVisitMetrics.d.ts`):
  Typings for sending metrics data.

- **Page Visit** (`CompletePageVisitPart.d.ts`):
  Typings for complete page visit parts.

#### WebSocket Endpoint

- **Page Visit Part** (`_pvPart.d.ts`): Typings for handling WebSocket messages.

## Contributing

Contributions are welcome! To get started:

1. Clone the repository:

   ```bash
   git clone https://gitlab.com/noibu/metroplex-ts-bindings.git
   ```

2. Install dependencies:

   ```bash
   npm install
   ```

3. Make your changes and submit a pull request.

## License

This project is licensed under the ISC License.

## Links

- **Repository:** [Metroplex TS Bindings](https://gitlab.com/noibu/metroplex-ts-bindings)
- **Issues:** [Report Issues](https://gitlab.com/noibu/metroplex-ts-bindings/issues)
- **Homepage:** [Metroplex TS Bindings Documentation](https://gitlab.com/noibu/metroplex-ts-bindings#readme)
