// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import * as ListsAPI from './lists'; import { APIPromise } from '../core/api-promise'; import { buildHeaders } from '../internal/headers'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; export class Lists extends APIResource { /** * Create a new list */ create(body: ListCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/lists', { body, ...options }); } /** * Get a specific list */ retrieve(id: number, options?: RequestOptions): APIPromise { return this._client.get(path`/lists/${id}`, options); } /** * Update a list */ update(id: number, body: ListUpdateParams, options?: RequestOptions): APIPromise { return this._client.put(path`/lists/${id}`, { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Get all lists */ list( query: ListListParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get('/lists', { query, ...options }); } /** * Delete a list */ delete(id: number, options?: RequestOptions): APIPromise { return this._client.delete(path`/lists/${id}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export interface List { id?: number; created_at?: string; name?: string; optin?: 'single' | 'double'; subscriber_count?: number; tags?: Array; type?: 'public' | 'private'; updated_at?: string; uuid?: string; } export interface ListInput { name: string; optin: 'single' | 'double'; type: 'public' | 'private'; tags?: Array; } export interface ListCreateResponse { data?: List; } export interface ListRetrieveResponse { data?: List; } export interface ListListResponse { data?: ListListResponse.Data; } export namespace ListListResponse { export interface Data { page?: number; per_page?: number; results?: Array; total?: number; } } export interface ListCreateParams { name: string; optin: 'single' | 'double'; type: 'public' | 'private'; tags?: Array; } export interface ListUpdateParams { name: string; optin: 'single' | 'double'; type: 'public' | 'private'; tags?: Array; } export interface ListListParams { /** * Sort order */ order?: 'asc' | 'desc'; /** * Field to order by */ order_by?: 'name' | 'created_at' | 'updated_at'; page?: number; per_page?: number; /** * Optional search query */ query?: string; } export declare namespace Lists { export { type List as List, type ListInput as ListInput, type ListCreateResponse as ListCreateResponse, type ListRetrieveResponse as ListRetrieveResponse, type ListListResponse as ListListResponse, type ListCreateParams as ListCreateParams, type ListUpdateParams as ListUpdateParams, type ListListParams as ListListParams, }; }