// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import * as PreferencesAPI from './preferences'; import { PreferenceRetrieveParams, PreferenceUpdateParams, Preferences, UserPreferenceResponse, UserPreferenceSlug, UserPreferenceType, } from './preferences'; import { APIPromise } from '../../../core/api-promise'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; export class Me extends APIResource { preferences: PreferencesAPI.Preferences = new PreferencesAPI.Preferences(this._client); /** * Returns the authenticated user's message usage and limit for the current month. * limit and remaining are null when the quota is unlimited. Requires X-Tenant-ID * header. */ retrieveMessageQuota( params: MeRetrieveMessageQuotaParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat } = params ?? {}; return this._client.get('/users/me/message-quota', { ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } } /** * Response model for the current user's monthly message quota. * * Attributes: used (int): Messages the user has sent in the current month. limit * (int | None): Monthly message limit per user. None when the quota is unlimited. * remaining (int | None): Messages left this month, never negative. None when the * quota is unlimited. resets_at (datetime): When the quota counter resets (start * of next month, UTC). */ export interface MeRetrieveMessageQuotaResponse { /** * When the quota resets (start of next month, UTC) */ resets_at: string; /** * Messages sent by the user in the current month */ used: number; /** * Monthly message limit per user; null when unlimited */ limit?: number | null; /** * Messages left this month; null when unlimited */ remaining?: number | null; } export interface MeRetrieveMessageQuotaParams { 'Accept-Language'?: string; /** * Set to `structured` to receive errors in the structured envelope. Omit it to * keep the legacy error body. */ 'X-Error-Format'?: string; } Me.Preferences = Preferences; export declare namespace Me { export { type MeRetrieveMessageQuotaResponse as MeRetrieveMessageQuotaResponse, type MeRetrieveMessageQuotaParams as MeRetrieveMessageQuotaParams, }; export { Preferences as Preferences, type UserPreferenceResponse as UserPreferenceResponse, type UserPreferenceSlug as UserPreferenceSlug, type UserPreferenceType as UserPreferenceType, type PreferenceRetrieveParams as PreferenceRetrieveParams, type PreferenceUpdateParams as PreferenceUpdateParams, }; }