# Task ID: 4
# Title: Implement, Document, & Test `getChatPicture` Endpoint
# Status: done
# Dependencies: 1
# Priority: medium
# Description: Implement the `getChatPicture` method, write JSDoc/TSDoc documentation, and develop unit tests. Ensure adherence to SDK conventions for API calls, error handling, and authentication.
# Details:
Functional Requirement 4.3: Method: getChatPicture(session: string, chatId: string, options?: { refresh?: boolean }): Promise. API Call: GET /api/{session}/chats/{chatId}/picture. Parameters: session (path, required), chatId (path, required), refresh (query, optional). Response: ChatPictureResponse object. Adhere to NFRs.

# Test Strategy:
Unit tests for retrieving chat picture, handling refresh option, error cases (e.g., chat not found, picture not available), and parameter validation.

# Subtasks:
## 1. Implement `getChatPicture` Method and Parameter Handling [done]
### Dependencies: None
### Description: Implement the `getChatPicture` method's core logic: making the GET request to `/api/{session}/chats/{chatId}/picture`, handling path parameters (session, chatId) and the optional query parameter (refresh), and processing the `ChatPictureResponse`.
### Details:
Define the function signature for `getChatPicture(session: string, chatId: string, options?: { refresh?: boolean }): Promise<ChatPictureResponse>`. Implement the core logic to construct the API request URL and include the `refresh` query parameter if provided. Ensure the method returns the `ChatPictureResponse`.

## 2. Integrate Error Handling and Authentication for `getChatPicture` [done]
### Dependencies: None
### Description: Integrate SDK-standard error handling for API responses (e.g., 404s, specific errors for picture unavailability) and parameter validation. SDK authentication for the call is typically handled by the HTTP client.
### Details:
Implement robust error handling for API responses and network issues, translating them into SDK-standard errors (e.g., throwing a new Error with a descriptive message). Authentication is generally handled by the `httpClient`; this subtask ensures the standard try/catch error handling pattern is applied.

## 3. Write JSDoc/TSDoc Documentation for `getChatPicture` [done]
### Dependencies: None
### Description: Write JSDoc/TSDoc for the `getChatPicture` method, its parameters (including `options` and `refresh`), return type (`ChatPictureResponse`), and error conditions.
### Details:
Document the method's purpose, all input parameters (session, chatId, options.refresh), and the structure of the resolved `Promise<ChatPictureResponse>`. Clearly describe potential errors, such as chat not found or picture unavailable.

## 4. Develop Unit Tests for `getChatPicture` [done]
### Dependencies: None
### Description: Develop unit tests as per the test strategy: successful retrieval (with/without `refresh`), error cases (chat not found, picture not available, invalid params), and API/auth failures.
### Details:
Create test cases to verify: successful retrieval of `ChatPictureResponse`, correct application of the `refresh` query parameter, and proper error handling for scenarios like chat/picture not found, invalid parameters, and simulated API/authentication failures. Mock API responses as needed.

