import { type ApiClientInterface, BaseService, type CommonErrors, type ServiceDependencies } from "../../api/base-service"; export type { Ticket, TicketTransfer, TicketTransferStatus, TicketTransfersListResponse } from "./schemas"; import { type Ticket, type TicketTransfer, type TicketTransfersListResponse } from "./schemas"; /** * Error identifiers the ticket transfer endpoints return in response bodies. * See docs/API.md ("Ticket Transfers") in the Unidy backend. */ declare const TICKET_TRANSFER_ERROR_IDENTIFIERS: readonly ["feature_disabled", "not_ticket_owner", "not_transfer_sender", "offer_email_failed", "recipient_invite_failed", "recipient_is_owner", "recipient_mismatch", "ticket_already_transferred", "ticket_not_active", "ticket_not_transferred", "transfer_already_pending", "transfer_expired", "transfer_not_pending"]; export type TicketTransferErrorIdentifier = (typeof TICKET_TRANSFER_ERROR_IDENTIFIERS)[number]; export type TicketTransferCreateArgs = { ticketId: string; recipientEmail: string; }; export type TicketTransferTokenArgs = { token: string; }; export type TicketTransferTicketArgs = { ticketId: string; }; export type TicketTransferError = CommonErrors | ["missing_id_token", null] | [TicketTransferErrorIdentifier, null] | ["not_found", null] | ["unauthorized", null] | ["server_error", null] | ["invalid_response", null]; export type TicketTransfersListResult = TicketTransferError | [null, TicketTransfersListResponse]; export type TicketTransferActionResult = TicketTransferError | [null, TicketTransfer]; /** Result type for revoke/return — the backend returns the updated ticket, not a transfer object. */ export type TicketTransferTicketActionResult = TicketTransferError | [null, Ticket]; export declare class TicketTransfersService extends BaseService { constructor(client: ApiClientInterface, deps?: ServiceDependencies); /** Lists the user's pending, unexpired transfers, split into incoming and outgoing. */ list(): Promise; /** Sends a transfer offer for an owned ticket to the given email address. */ create(args: TicketTransferCreateArgs): Promise; /** Accepts a transfer offer addressed to the authenticated user. The ticket moves to them. */ accept(args: TicketTransferTokenArgs): Promise; /** Declines a transfer offer addressed to the authenticated user. */ decline(args: TicketTransferTokenArgs): Promise; /** Cancels a pending transfer offer previously sent by the authenticated user. */ cancel(args: TicketTransferTokenArgs): Promise; /** Owner pulls a transferred ticket back from its current holder. Returns the updated ticket. */ revoke(args: TicketTransferTicketArgs): Promise; /** Holder returns a transferred ticket back to its owner. Returns the updated ticket. */ return(args: TicketTransferTicketArgs): Promise; private postTicketAction; private postAction; /** * A consumer-injected getIdToken may reject instead of returning null — * methods must still resolve to the documented [error, data] tuple. */ private resolveIdToken; /** * Maps a failed response to a typed error tuple. The backend communicates * domain errors via `error_identifier` in the body; status codes are only a * fallback for responses without one (e.g. 404 from a wrong token). */ private errorIdentifierResult; }