# Class MEPClient

Sub-client for MEP-related European Parliament API endpoints.

Handles all MEP data fetching: active lists, individual profiles, incoming/outgoing/homonym lists, and financial declarations.

#### Hierarchy (View Summary)

- BaseEPClient
  - MEPClient

- Defined in clients/ep/mepClient.ts:43

##### Index

### Constructors

constructor

### Properties

baseURL
cache
enableRetry
maxResponseBytes
maxRetries
rateLimiter
timeoutMs

### Methods

buildMEPParams
clearCache
evictFromCache
fetchAllCurrentMEPs
filterMEPs
get
getCacheStats
getCurrentMEPs
getHomonymMEPs
getIncomingMEPs
getMEPDeclarationById
getMEPDeclarations
getMEPDeclarationsFeed
getMEPDetails
getMEPs
getMEPsFeed
getOutgoingMEPs
paginateFiltered
transformMEP
transformMEPDeclaration
transformMEPDetails

## Constructors

### constructor

- new MEPClient(config?: EPClientConfig, shared?: EPSharedResources): MEPClient

  #### Parameters

  - config: EPClientConfig = {}
  - `Optional` shared: EPSharedResources

  #### Returns MEPClient

  Overrides BaseEPClient.constructor

  - Defined in clients/ep/mepClient.ts:44

## Properties

### `Protected` `Readonly` baseURL

baseURL: string

European Parliament API base URL.

Inherited from BaseEPClient.baseURL

- Defined in clients/ep/baseClient.ts:217

### `Protected` `Readonly` cache

cache: LRUCache<string, Record<string, unknown>>

LRU cache for API responses.

Inherited from BaseEPClient.cache

- Defined in clients/ep/baseClient.ts:215

### `Protected` `Readonly` enableRetry

enableRetry: boolean

Enable automatic retry on transient failures.

Inherited from BaseEPClient.enableRetry

- Defined in clients/ep/baseClient.ts:223

### `Protected` `Readonly` maxResponseBytes

maxResponseBytes: number

Maximum allowed response body size in bytes.

Inherited from BaseEPClient.maxResponseBytes

- Defined in clients/ep/baseClient.ts:227

### `Protected` `Readonly` maxRetries

maxRetries: number

Maximum number of retry attempts.

Inherited from BaseEPClient.maxRetries

- Defined in clients/ep/baseClient.ts:225

### `Protected` `Readonly` rateLimiter

rateLimiter: RateLimiter

Token bucket rate limiter.

Inherited from BaseEPClient.rateLimiter

- Defined in clients/ep/baseClient.ts:219

### `Protected` `Readonly` timeoutMs

timeoutMs: number

Request timeout in milliseconds.

Inherited from BaseEPClient.timeoutMs

- Defined in clients/ep/baseClient.ts:221

## Methods

### `Private` buildMEPParams

- buildMEPParams(
  params: {
  active?: boolean;
  committee?: string;
  country?: string;
  group?: string;
  limit?: number;
  offset?: number;
  },
  ): Record<string, unknown>

  Maps getMEPs params to EP API query parameters.

  #### Parameters

  - params: {
    active?: boolean;
    committee?: string;
    country?: string;
    group?: string;
    limit?: number;
    offset?: number;
    }

  #### Returns Record<string, unknown>

  #### Private

  - Defined in clients/ep/mepClient.ts:64

### clearCache

- clearCache(): void

  Clears all entries from the LRU cache.

  #### Returns void

  Inherited from BaseEPClient.clearCache

  - Defined in clients/ep/baseClient.ts:666

### `Protected` evictFromCache

- evictFromCache(endpoint: string, params?: Record<string, unknown>): void

  Evicts a single cache entry matching the given endpoint and params. Sub-clients use this when they detect that a successfully-fetched payload is a content-pending sentinel that must not be served from cache for the remainder of the TTL — eviction lets availability recover as soon as the upstream document is enriched.

  #### Parameters

  - endpoint: string

    API endpoint path (same value passed to get)

  - `Optional` params: Record<string, unknown>

    Optional query parameters (same value passed to get)

  #### Returns void

  #### Protected

  Inherited from BaseEPClient.evictFromCache

  - Defined in clients/ep/baseClient.ts:681

### `Private` fetchAllCurrentMEPs

- fetchAllCurrentMEPs(): Promise<MEP[]>

  Fetch all current MEPs in paginated batches (max 100 per request).

  #### Returns Promise<MEP[]>

  - Defined in clients/ep/mepClient.ts:103

### `Private` filterMEPs

- filterMEPs(
  meps: MEP[],
  country: string | undefined,
  group: string | undefined,
  ): MEP[]

  Apply optional client-side country and group filters to an MEP array.

  #### Parameters

  - meps: MEP[]
  - country: string | undefined
  - group: string | undefined

  #### Returns MEP[]

  - Defined in clients/ep/mepClient.ts:83

### `Protected` get

- get<T extends Record<string, unknown>>(
  endpoint: string,
  params?: Record<string, unknown>,
  minimumTimeoutMs?: number,
  ): Promise<T>

  Executes a cached, rate-limited GET request to the EP API.

  #### Type Parameters

  - T extends Record<string, unknown>

    Expected response type (extends `Record<string, unknown>`)

  #### Parameters

  - endpoint: string

    API endpoint path (relative to `baseURL`)

  - `Optional` params: Record<string, unknown>

    Optional query parameters

  - `Optional` minimumTimeoutMs: number

    Optional per-request minimum timeout in milliseconds. When provided, the effective timeout is `Math.max(minimumTimeoutMs, this.timeoutMs)`, so the global timeout (set via `--timeout` or `EP_REQUEST_TIMEOUT_MS`) can still extend it beyond the per-endpoint minimum. Use for known slow EP API endpoints such as `procedures/feed`.

  #### Returns Promise<T>

  Promise resolving to the typed API response

  #### Throws

  On HTTP errors, network failures, or parse failures

  #### Protected

  Inherited from BaseEPClient.get

  - Defined in clients/ep/baseClient.ts:606

### getCacheStats

- getCacheStats(): {
  hitRate: number;
  hits: number;
  maxSize: number;
  misses: number;
  size: number;
  }

  Returns cache statistics for monitoring and debugging.

  #### Returns { hitRate: number; hits: number; maxSize: number; misses: number; size: number }

  `{ size, maxSize, hitRate, hits, misses }`

  Inherited from BaseEPClient.getCacheStats

  - Defined in clients/ep/baseClient.ts:690

### getCurrentMEPs

- getCurrentMEPs(
  params?: {
  country?: string;
  group?: string;
  limit?: number;
  offset?: number;
  },
  ): Promise<PaginatedResponse<MEP>>

  Returns all currently active MEPs for today's date.

  Unlike `getMEPs()`, this uses `GET /meps/show-current` which returns `api:country-of-representation` and `api:political-group` in responses. Optional `country` and `group` filters are applied client-side after fetch.

  EP API Endpoint: `GET /meps/show-current`

  #### Parameters

  - params: { country?: string; group?: string; limit?: number; offset?: number } = {}

    Optional filters and pagination

    - ##### `Optional` country?: string

      ISO 3166-1 alpha-2 country code for client-side filtering

    - ##### `Optional` group?: string

      Political group identifier for client-side filtering

    - ##### `Optional` limit?: number

      Maximum results to return (default 50)

    - ##### `Optional` offset?: number

      Pagination offset (default 0)

  #### Returns Promise<PaginatedResponse<MEP>>

  - Defined in clients/ep/mepClient.ts:240

### getHomonymMEPs

- getHomonymMEPs(
  params?: { limit?: number; offset?: number },
  ): Promise<PaginatedResponse<MEP>>

  Returns homonym MEPs for the current parliamentary term. EP API Endpoint: `GET /meps/show-homonyms`

  #### Parameters

  - params: { limit?: number; offset?: number } = {}

  #### Returns Promise<PaginatedResponse<MEP>>

  - Defined in clients/ep/mepClient.ts:317

### getIncomingMEPs

- getIncomingMEPs(
  params?: { limit?: number; offset?: number },
  ): Promise<PaginatedResponse<MEP>>

  Returns all incoming MEPs for the current parliamentary term. EP API Endpoint: `GET /meps/show-incoming`

  #### Parameters

  - params: { limit?: number; offset?: number } = {}

  #### Returns Promise<PaginatedResponse<MEP>>

  - Defined in clients/ep/mepClient.ts:271

### getMEPDeclarationById

- getMEPDeclarationById(docId: string): Promise<MEPDeclaration>

  Returns a single MEP declaration by document ID. EP API Endpoint: `GET /meps-declarations/{doc-id}`

  #### Parameters

  - docId: string

  #### Returns Promise<MEPDeclaration>

  #### Gdpr

  Declarations contain personal financial data – access is audit-logged

  - Defined in clients/ep/mepClient.ts:412

### getMEPDeclarations

- getMEPDeclarations(
  params?: { limit?: number; offset?: number; year?: number },
  ): Promise<PaginatedResponse<MEPDeclaration>>

  Returns MEP declarations of financial interests. EP API Endpoint: `GET /meps-declarations`

  #### Parameters

  - params: { limit?: number; offset?: number; year?: number } = {}

  #### Returns Promise<PaginatedResponse<MEPDeclaration>>

  #### Gdpr

  Declarations contain personal financial data – access is audit-logged

  - Defined in clients/ep/mepClient.ts:341

### getMEPDeclarationsFeed

- getMEPDeclarationsFeed(
  params?: { startDate?: string; timeframe?: string; workType?: string },
  ): Promise<JSONLDResponse<Record<string, unknown>>>

  Retrieves recently updated MEP declarations via the feed endpoint. EP API Endpoint: `GET /meps-declarations/feed`

  Configurable-window feed. Extended timeout applied for `one-month`.

  #### Parameters

  - params: { startDate?: string; timeframe?: string; workType?: string } = {}

  #### Returns Promise<JSONLDResponse<Record<string, unknown>>>

  - Defined in clients/ep/mepClient.ts:391

### getMEPDetails

- getMEPDetails(id: string): Promise<MEPDetails>

  Retrieves detailed information about a specific MEP.

  Supports numeric ID ("124936"), person URI ("person/124936"), or MEP-prefixed ID ("MEP-124936").

  #### Parameters

  - id: string

    MEP identifier in any supported format

  #### Returns Promise<MEPDetails>

  Detailed MEP information

  #### Security

  Personal data access logged per GDPR Article 30

  - Defined in clients/ep/mepClient.ts:196

### getMEPs

- getMEPs(
  params: {
  active?: boolean;
  committee?: string;
  country?: string;
  group?: string;
  limit?: number;
  offset?: number;
  },
  ): Promise<PaginatedResponse<MEP>>

  Retrieves Members of the European Parliament with filtering and pagination.

  #### Parameters

  - params: {
    active?: boolean;
    committee?: string;
    country?: string;
    group?: string;
    limit?: number;
    offset?: number;
    }

    Country, group, committee, active status, limit, offset

  #### Returns Promise<PaginatedResponse<MEP>>

  Paginated MEP list

  #### Security

  Personal data access logged per GDPR Article 30

  - Defined in clients/ep/mepClient.ts:146

### getMEPsFeed

- getMEPsFeed(
  params?: { startDate?: string; timeframe?: string },
  ): Promise<JSONLDResponse<Record<string, unknown>>>

  Retrieves recently updated MEPs via the feed endpoint. EP API Endpoint: `GET /meps/feed`

  Configurable-window feed. Extended timeout applied for `one-month`.

  #### Parameters

  - params: { startDate?: string; timeframe?: string } = {}

  #### Returns Promise<JSONLDResponse<Record<string, unknown>>>

  - Defined in clients/ep/mepClient.ts:371

### getOutgoingMEPs

- getOutgoingMEPs(
  params?: { limit?: number; offset?: number },
  ): Promise<PaginatedResponse<MEP>>

  Returns all outgoing MEPs for the current parliamentary term. EP API Endpoint: `GET /meps/show-outgoing`

  #### Parameters

  - params: { limit?: number; offset?: number } = {}

  #### Returns Promise<PaginatedResponse<MEP>>

  - Defined in clients/ep/mepClient.ts:294

### `Private` paginateFiltered

- paginateFiltered(
  meps: MEP[],
  limit: number,
  offset: number,
  filtered: boolean,
  ): PaginatedResponse<MEP>

  Build paginated result from filtered MEPs.

  #### Parameters

  - meps: MEP[]
  - limit: number
  - offset: number
  - filtered: boolean

  #### Returns PaginatedResponse<MEP>

  - Defined in clients/ep/mepClient.ts:126

### `Private` transformMEP

- transformMEP(apiData: Record<string, unknown>): MEP

  #### Parameters

  - apiData: Record<string, unknown>

  #### Returns MEP

  - Defined in clients/ep/mepClient.ts:48

### `Private` transformMEPDeclaration

- transformMEPDeclaration(apiData: Record<string, unknown>): MEPDeclaration

  #### Parameters

  - apiData: Record<string, unknown>

  #### Returns MEPDeclaration

  - Defined in clients/ep/mepClient.ts:56

### `Private` transformMEPDetails

- transformMEPDetails(apiData: Record<string, unknown>): MEPDetails

  #### Parameters

  - apiData: Record<string, unknown>

  #### Returns MEPDetails

  - Defined in clients/ep/mepClient.ts:52