topsort.js is the official Topsort javascript client library. This project is built with TypeScript and uses Bun for package management and testing.
Installation
Using npm:
Using yarn:
Usage
Auctions
To create an auction, first initialize a Topsort Client, then call the createAuction function:
Parameters
config: An object containing configuration details including the API key. Please refer to Auction Manager
Config Parameters
apiKey: Your Topsort API Key
userAgent: Optional user agent to be added as part of the request. Example: Mozilla/5.0
timeout: Optional timeout in milliseconds. Default is 30 seconds. If timeout is reached, the call will be rejected with an AbortError.
auctionDetails: An object containing the details of the auction to be created, please refer to Topsort’s Auction API doc for body specification.
Sample response
200:
400:
Events
To report an event, first initialize a Topsort Client, then call the reportEvent function:
Parameters
config: An object containing configuration details including the API key. Please refer to Auction Manager
event: An object containing the details of the event to be reported, please refer to Topsort’s Event API doc for body specification.
Sample response
200:
400:
429:
Retryable Errors
The reportEvent function returns "retry": true if the response status code is 429 or any 5xx. This enables you to identify when it’s appropriate to retry the function call.