# Preferences

The `Preferences` class manages user preferences and consent states.

**Class: `Preferences`**

**Constructor**

* `constructor(client: Client)`: Initializes a new preferences instance.

**Instance Methods**

* `sync(): Promise<number>`: Synchronizes the user's preferences from the network.
* `async inboxState(refreshFromNetwork?: boolean): Promise<SafeInboxState>`: Retrieves the current inbox state.
* `async inboxStateFromInboxIds(inboxIds: string[], refreshFromNetwork?: boolean): Promise<SafeInboxState[]>`: Retrieves inbox state for specific inbox IDs.
* `async getLatestInboxState(inboxId: string): Promise<SafeInboxState>`: Gets the latest inbox state for a specific inbox.
* `async setConsentStates(records: SafeConsent[]): Promise<void>`: Updates consent states for multiple records.
* `async getConsentState(entityType: ConsentEntityType, entity: string): Promise<ConsentState>`: Retrieves consent state for a specific entity.
* `async streamConsent(callback?: StreamCallback<SafeConsent[]>): Promise<AsyncStream<SafeConsent[]>>`: Creates a stream of consent state updates.
* `async streamPreferences(callback?: StreamCallback<UserPreference[]>): Promise<AsyncStream<UserPreference[]>>`: Creates a stream of user preference updates.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cryptalks-organization-1.gitbook.io/cryptalk-sdk/preferences.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
