///
The Quicksilver SDK provides robust capabilities for managing streaming payments and subscribing to real-time events, enabling dynamic and responsive financial applications.
32 views
~32 views from guests
Guest views are estimated from total page views. These include anonymous visitors and users who weren't logged in when they viewed the page.
The Quicksilver SDK provides robust capabilities for managing streaming payments and subscribing to real-time events, enabling dynamic and responsive financial applications.
StreamsResourceThe StreamsResource class provides methods for interacting with streaming transactions, including retrieval, control, and subscription to real-time updates. It is typically accessed via client.streams.
constructor(httpClient: HttpClient, baseURL: string, apiKey: string)Initializes the StreamsResource.
httpClient: HttpClient - The HTTP client instance for making API requests.baseURL: string - The base URL of the Quicksilver API.apiKey: string - The API key used for authentication.retrieve(id: string): Promise<StreamingTransaction>Promise<StreamingTransaction> // Retrieves the current state and details of a specific streaming transaction.
id: string - The unique identifier of the streaming transaction.list(params?: PaginationParams & { from?: string; to?: string; state?: string; }): Promise<PaginatedResponse<StreamingTransaction>>Promise<PaginatedResponse<StreamingTransaction>> // Lists all streaming transactions with optional pagination and filtering.
params: PaginationParams & { from?: string; to?: string; state?: string; } - Pagination and filter parameters such as page, limit, cursor, from account ID, to account ID, and state.pause(id: string): Promise<StatusResponse>Promise<StatusResponse> // Pauses a currently active streaming transaction.
id: string - The unique identifier of the stream to pause.resume(id: string): Promise<StatusResponse>Promise<StatusResponse> // Resumes a previously paused streaming transaction.
id: string - The unique identifier of the stream to resume.stop(id: string): Promise<StatusResponse>Promise<StatusResponse> // Permanently stops a streaming transaction, finalizing any accumulated payments.
id: string - The unique identifier of the stream to stop.update(id: string, payload: { rate?: number; rate_unit?: string; end_time?: string; }): Promise<StreamingTransaction>Promise<StreamingTransaction> // Updates the configuration of an existing streaming transaction, such as its rate or end time.
id: string - The unique identifier of the stream to update.payload: { rate?: number; rate_unit?: string; end_time?: string; } - The updated parameters for the stream, including rate, rate_unit, and end_time.getForAccount(accountId: string, params?: PaginationParams & { state?: string; }): Promise<PaginatedResponse<StreamingTransaction>>Promise<PaginatedResponse<StreamingTransaction>> // Retrieves a list of streaming transactions associated with a specific account.
accountId: string - The unique identifier of the account.params: PaginationParams & { state?: string; } - Pagination parameters and optional state filter.subscribe(id: string): StreamConnectionStreamConnection // Subscribes to real-time events for a specific streaming transaction.
id: string - The unique identifier of the stream to subscribe to.subscribeToAccount(accountId: string): StreamConnectionStreamConnection // Subscribes to real-time events for all streaming transactions related to a specific account.
accountId: string - The unique identifier of the account.subscribeToAll(): StreamConnectionStreamConnection // Subscribes to real-time events for all streaming transactions across the entire system (requires admin privileges).
StreamConnection (Events)This interface extends EventEmitter and defines the specific events that can be listened for on a StreamConnection instance.
on(event: 'stream_event', listener: (data: SSEStreamEvent) => void): this // Emitted when a general stream event occurs (e.g., streamstarted, paused, resumed, stopped, completed).on(event: 'batch_created', listener: (data: SSEBatchCreatedEvent) => void): this // Emitted when a batch payment is created as part of a streaming transaction.on(event: 'open', listener: () => void): this // Emitted when the Server-Sent Events (SSE) connection is successfully established.on(event: 'error', listener: (error: Event) => void): this // Emitted when an error occurs with the SSE connection.on(event: 'close', listener: () => void): this // Emitted when the SSE connection is closed.on(event: string, listener: (...args: any[]) => void): this // Generic event listener for any custom events.StreamConnectionThe StreamConnection class manages a Server-Sent Events (SSE) connection to receive real-time updates for streaming transactions. It extends Node.js EventEmitter.
constructor(url: URL, apiKey?: string)Initializes a new StreamConnection to the specified URL.
url: URL - The URL for the Server-Sent Events endpoint.apiKey: string - (Optional) The API key to include in the URL query parameters for authentication.readyState: numbernumber // Returns the current state of the SSE connection (0: CONNECTING, 1: OPEN, 2: CLOSING, 3: CLOSED).
url: stringstring // Returns the URL that the StreamConnection is connected to.
close(): voidvoid // Closes the connection to the server and stops receiving events.
setMaxReconnectAttempts(maxAttempts: number): voidvoid // Sets the maximum number of times the connection will attempt to reconnect after a disconnection.
maxAttempts: number - The maximum number of reconnection attempts.setReconnectDelay(delay: number): voidvoid // Sets the initial delay (in milliseconds) before attempting to reconnect after a disconnection.
delay: number - The initial delay in milliseconds.