# Class QuestionClient

Sub-client for parliamentary-questions EP API endpoints.

#### Hierarchy (View Summary)

- BaseEPClient
  - QuestionClient

- Defined in clients/ep/questionClient.ts:33

##### Index

### Constructors

constructor

### Properties

baseURL
cache
enableRetry
maxResponseBytes
maxRetries
rateLimiter
timeoutMs

### Methods

buildQuestionSearchParams
clearCache
evictFromCache
filterQuestions
get
getCacheStats
getParliamentaryQuestionById
getParliamentaryQuestions
getParliamentaryQuestionsFeed
transformParliamentaryQuestion

## Constructors

### constructor

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

  #### Parameters

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

  #### Returns QuestionClient

  Overrides BaseEPClient.constructor

  - Defined in clients/ep/questionClient.ts:34

## 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` buildQuestionSearchParams

- buildQuestionSearchParams(
  params: {
  dateFrom?: string;
  limit?: number;
  offset?: number;
  type?: "WRITTEN" | "ORAL";
  },
  ): Record<string, unknown>

  Builds EP API parameters for parliamentary question search.

  #### Parameters

  - params: {
    dateFrom?: string;
    limit?: number;
    offset?: number;
    type?: "WRITTEN" | "ORAL";
    }

  #### Returns Record<string, unknown>

  #### Private

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

### 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` filterQuestions

- filterQuestions(
  questions: ParliamentaryQuestion[],
  params: {
  author?: string;
  dateTo?: string;
  status?: "PENDING" | "ANSWERED";
  topic?: string;
  },
  ): ParliamentaryQuestion[]

  Applies client-side filters to parliamentary questions.

  #### Parameters

  - questions: ParliamentaryQuestion[]
  - params: {
    author?: string;
    dateTo?: string;
    status?: "PENDING" | "ANSWERED";
    topic?: string;
    }

  #### Returns ParliamentaryQuestion[]

  #### Private

  - Defined in clients/ep/questionClient.ts:69

### `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

### getParliamentaryQuestionById

- getParliamentaryQuestionById(docId: string): Promise<ParliamentaryQuestion>

  Returns a single parliamentary question by document ID. EP API Endpoint: `GET /parliamentary-questions/{doc-id}`

  #### Parameters

  - docId: string

  #### Returns Promise<ParliamentaryQuestion>

  - Defined in clients/ep/questionClient.ts:172

### getParliamentaryQuestions

- getParliamentaryQuestions(
  params: {
  author?: string;
  dateFrom?: string;
  dateTo?: string;
  limit?: number;
  offset?: number;
  status?: "PENDING" | "ANSWERED";
  topic?: string;
  type?: "WRITTEN" | "ORAL";
  },
  ): Promise<PaginatedResponse<ParliamentaryQuestion>>

  Retrieves parliamentary questions with filtering by type, author, and status.

  EP API Endpoint: `GET /parliamentary-questions`

  #### Parameters

  - params: {
    author?: string;
    dateFrom?: string;
    dateTo?: string;
    limit?: number;
    offset?: number;
    status?: "PENDING" | "ANSWERED";
    topic?: string;
    type?: "WRITTEN" | "ORAL";
    }

    type, author, topic, status, dateFrom, dateTo, limit, offset

  #### Returns Promise<PaginatedResponse<ParliamentaryQuestion>>

  Paginated parliamentary questions list

  #### Security

  Audit logged per GDPR Article 30

  - Defined in clients/ep/questionClient.ts:105

### getParliamentaryQuestionsFeed

- getParliamentaryQuestionsFeed(): Promise<
  JSONLDResponse<Record<string, unknown>>,
  >

  Retrieves recently updated parliamentary questions via the feed endpoint. EP API Endpoint: `GET /parliamentary-questions/feed`

  Fixed-window feed — no `timeframe` parameter per OpenAPI spec. Extended timeout applied (120 s minimum).

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

  - Defined in clients/ep/questionClient.ts:162

### `Private` transformParliamentaryQuestion

- transformParliamentaryQuestion(
  apiData: Record<string, unknown>,
  ): ParliamentaryQuestion

  #### Parameters

  - apiData: Record<string, unknown>

  #### Returns ParliamentaryQuestion

  - Defined in clients/ep/questionClient.ts:38