// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; export class Preference extends APIResource { /** * Get user personalization preference (style, tone, and custom instructions). */ retrieve( params: PreferenceRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { const { 'Accept-Language': acceptLanguage, 'If-None-Match': ifNoneMatch, 'X-Error-Format': xErrorFormat, } = params ?? {}; return this._client.get('/users/personalization/preference', { ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(ifNoneMatch != null ? { 'If-None-Match': ifNoneMatch } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } /** * Update user personalization preference (style, tone, and custom instructions). */ update( params: PreferenceUpdateParams, options?: RequestOptions, ): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...body } = params; return this._client.put('/users/personalization/preference', { body, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } } /** * Model for a single personalization option (style or tone). * * Attributes: key (str): The unique identifier for the option (e.g., 'friendly', * 'concise'). display_name (str): The human-readable display name for the option. * description (str): The short description of the option. */ export interface PersonalizationOptionItem { /** * The short description of the option */ description: string; /** * The human-readable display name */ display_name: string; /** * The unique identifier for the option */ key: string; } /** * Response model for user personalization preference. * * Attributes: style (PersonalizationOptionItem | None): The selected style option. * Defaults to None. tone (PersonalizationOptionItem | None): The selected tone * option. Defaults to None. custom_instructions (str | None): The custom * personalization instructions. Defaults to None. */ export interface UserPersonalizationPreferenceResponse { /** * The custom personalization instructions */ custom_instructions?: string | null; /** * Model for a single personalization option (style or tone). * * Attributes: key (str): The unique identifier for the option (e.g., 'friendly', * 'concise'). display_name (str): The human-readable display name for the option. * description (str): The short description of the option. */ style?: PersonalizationOptionItem | null; /** * Model for a single personalization option (style or tone). * * Attributes: key (str): The unique identifier for the option (e.g., 'friendly', * 'concise'). display_name (str): The human-readable display name for the option. * description (str): The short description of the option. */ tone?: PersonalizationOptionItem | null; } export interface PreferenceRetrieveParams { 'Accept-Language'?: string; 'If-None-Match'?: string; /** * Set to `structured` to receive errors in the structured envelope. Omit it to * keep the legacy error body. */ 'X-Error-Format'?: string; } export interface PreferenceUpdateParams { /** * Body param: Custom personalization instructions provided by the user */ custom_instructions?: string | null; /** * Body param: The key of the selected style option */ style_key?: string | null; /** * Body param: The key of the selected tone option */ tone_key?: string | null; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export declare namespace Preference { export { type PersonalizationOptionItem as PersonalizationOptionItem, type UserPersonalizationPreferenceResponse as UserPersonalizationPreferenceResponse, type PreferenceRetrieveParams as PreferenceRetrieveParams, type PreferenceUpdateParams as PreferenceUpdateParams, }; }