Class

RestRepository

RestRepository(adapter, clazzopt)

Constructor

# new RestRepository(adapter, clazzopt)

A specialized repository implementation for interacting with REST APIs. This class extends the core Repository class and works with HTTP adapters to provide CRUD operations for models via REST endpoints. This Is NOT the default repository for the HTTP adapter. That would be RestService. Use this only in the specific case of needing to run the CURD model logic (decoration) before submitting to the backend

Repository for REST API interactions

Parameters:
Name Type Attributes Description
adapter A

The HTTP adapter instance

clazz Constructor.<M> <optional>

Optional constructor for the model class

See:

View Source RestRepository.ts, line 3

Example
```typescript
// Create a repository for User model with Axios adapter
const axiosAdapter = new AxiosAdapter({
  protocol: 'https',
  host: 'api.example.com'
});
const userRepository = new RestRepository(axiosAdapter, User);

// Use the repository for CRUD operations
const user = await userRepository.findById('123');
```