@predictorsdk/client 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/Client.d.ts +21 -1
  2. package/dist/Client.js +135 -2
  3. package/dist/api/client/requests/GetMarketsRequest.d.ts +10 -0
  4. package/dist/api/client/requests/GetMarketsRequest.js +2 -0
  5. package/dist/api/client/requests/GetSportsMatchingMarketsRequest.d.ts +10 -4
  6. package/dist/api/client/requests/index.d.ts +1 -0
  7. package/dist/api/errors/BadGatewayError.d.ts +1 -0
  8. package/dist/api/errors/BadRequestError.d.ts +1 -0
  9. package/dist/api/errors/ForbiddenError.d.ts +1 -0
  10. package/dist/api/errors/PaymentRequiredError.d.ts +7 -0
  11. package/dist/api/errors/PaymentRequiredError.js +17 -0
  12. package/dist/api/errors/ServiceUnavailableError.d.ts +1 -0
  13. package/dist/api/errors/TooManyRequestsError.d.ts +1 -0
  14. package/dist/api/errors/UnauthorizedError.d.ts +1 -0
  15. package/dist/api/errors/index.d.ts +1 -0
  16. package/dist/api/errors/index.js +1 -0
  17. package/dist/api/types/MarketsListResponse.d.ts +7 -0
  18. package/dist/api/types/MarketsListResponse.js +2 -0
  19. package/dist/api/types/PaginationBlock.d.ts +10 -0
  20. package/dist/api/types/PaginationBlock.js +2 -0
  21. package/dist/api/types/PaymentRequiredErrorAction.d.ts +6 -0
  22. package/dist/api/types/PaymentRequiredErrorAction.js +6 -0
  23. package/dist/api/types/PaymentRequiredErrorBody.d.ts +20 -0
  24. package/dist/api/types/PaymentRequiredErrorBody.js +2 -0
  25. package/dist/api/types/SportsMatchingResponse.d.ts +2 -0
  26. package/dist/api/types/UnifiedMarket.d.ts +9 -0
  27. package/dist/api/types/UnifiedMarket.js +2 -0
  28. package/dist/api/types/UnifiedMarketProvider.d.ts +8 -0
  29. package/dist/api/types/UnifiedMarketProvider.js +8 -0
  30. package/dist/api/types/index.d.ts +6 -0
  31. package/dist/api/types/index.js +6 -0
  32. package/dist/serialization/types/MarketsListResponse.d.ts +12 -0
  33. package/dist/serialization/types/MarketsListResponse.js +8 -0
  34. package/dist/serialization/types/PaginationBlock.d.ts +12 -0
  35. package/dist/serialization/types/PaginationBlock.js +8 -0
  36. package/dist/serialization/types/PaymentRequiredErrorAction.d.ts +7 -0
  37. package/dist/serialization/types/PaymentRequiredErrorAction.js +3 -0
  38. package/dist/serialization/types/PaymentRequiredErrorBody.d.ts +17 -0
  39. package/dist/serialization/types/PaymentRequiredErrorBody.js +13 -0
  40. package/dist/serialization/types/SportsMatchingResponse.d.ts +2 -0
  41. package/dist/serialization/types/SportsMatchingResponse.js +2 -0
  42. package/dist/serialization/types/UnifiedMarket.d.ts +12 -0
  43. package/dist/serialization/types/UnifiedMarket.js +8 -0
  44. package/dist/serialization/types/UnifiedMarketProvider.d.ts +7 -0
  45. package/dist/serialization/types/UnifiedMarketProvider.js +3 -0
  46. package/dist/serialization/types/index.d.ts +6 -0
  47. package/dist/serialization/types/index.js +6 -0
  48. package/package.json +1 -1
package/dist/Client.d.ts CHANGED
@@ -11,13 +11,14 @@ export declare class PredictorSDKClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<PredictorSDKClient.Options>;
12
12
  constructor(options: PredictorSDKClient.Options);
13
13
  /**
14
- * Find cross-platform market matches for sports events. Provide a Kalshi event ticker or Polymarket market slug to look up the equivalent market on other platforms. When called without parameters, returns all currently matched sports markets.
14
+ * Find cross-platform market matches for sports events. When called without parameters, returns all currently matched sports markets with cursor-based pagination (default `limit=25`, max `100`). Provide a Kalshi event ticker, Polymarket slug, Predict market ID, or SX Bet market ID to look up a specific event lookups return the full match immediately and skip pagination.
15
15
  *
16
16
  * @param {PredictorSDK.GetSportsMatchingMarketsRequest} request
17
17
  * @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
18
18
  *
19
19
  * @throws {@link PredictorSDK.BadRequestError}
20
20
  * @throws {@link PredictorSDK.UnauthorizedError}
21
+ * @throws {@link PredictorSDK.PaymentRequiredError}
21
22
  * @throws {@link PredictorSDK.ForbiddenError}
22
23
  * @throws {@link PredictorSDK.TooManyRequestsError}
23
24
  * @throws {@link PredictorSDK.ServiceUnavailableError}
@@ -27,6 +28,24 @@ export declare class PredictorSDKClient {
27
28
  */
28
29
  getSportsMatchingMarkets(request?: PredictorSDK.GetSportsMatchingMarketsRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.SportsMatchingResponse>;
29
30
  private __getSportsMatchingMarkets;
31
+ /**
32
+ * Returns a paginated list of unified markets from all supported prediction market providers. Uses cursor-based pagination with default `limit=25`, max `100`.
33
+ *
34
+ * @param {PredictorSDK.GetMarketsRequest} request
35
+ * @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link PredictorSDK.BadRequestError}
38
+ * @throws {@link PredictorSDK.UnauthorizedError}
39
+ * @throws {@link PredictorSDK.PaymentRequiredError}
40
+ * @throws {@link PredictorSDK.ForbiddenError}
41
+ * @throws {@link PredictorSDK.TooManyRequestsError}
42
+ * @throws {@link PredictorSDK.ServiceUnavailableError}
43
+ *
44
+ * @example
45
+ * await client.getMarkets()
46
+ */
47
+ getMarkets(request?: PredictorSDK.GetMarketsRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.MarketsListResponse>;
48
+ private __getMarkets;
30
49
  /**
31
50
  * Returns per-second price data for a Binance trading pair. When called without a time range, returns the latest price. With `start_time` and `end_time`, returns historical per-second prices in newest-first order. Supports cursor-based pagination for large result sets. Unknown or invalid symbols return `200` with `{"prices":[]}` and omit `total`.
32
51
  *
@@ -35,6 +54,7 @@ export declare class PredictorSDKClient {
35
54
  *
36
55
  * @throws {@link PredictorSDK.BadRequestError}
37
56
  * @throws {@link PredictorSDK.UnauthorizedError}
57
+ * @throws {@link PredictorSDK.PaymentRequiredError}
38
58
  * @throws {@link PredictorSDK.ForbiddenError}
39
59
  * @throws {@link PredictorSDK.TooManyRequestsError}
40
60
  * @throws {@link PredictorSDK.BadGatewayError}
package/dist/Client.js CHANGED
@@ -13,13 +13,14 @@ export class PredictorSDKClient {
13
13
  this._options = normalizeClientOptionsWithAuth(options);
14
14
  }
15
15
  /**
16
- * Find cross-platform market matches for sports events. Provide a Kalshi event ticker or Polymarket market slug to look up the equivalent market on other platforms. When called without parameters, returns all currently matched sports markets.
16
+ * Find cross-platform market matches for sports events. When called without parameters, returns all currently matched sports markets with cursor-based pagination (default `limit=25`, max `100`). Provide a Kalshi event ticker, Polymarket slug, Predict market ID, or SX Bet market ID to look up a specific event lookups return the full match immediately and skip pagination.
17
17
  *
18
18
  * @param {PredictorSDK.GetSportsMatchingMarketsRequest} request
19
19
  * @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
20
20
  *
21
21
  * @throws {@link PredictorSDK.BadRequestError}
22
22
  * @throws {@link PredictorSDK.UnauthorizedError}
23
+ * @throws {@link PredictorSDK.PaymentRequiredError}
23
24
  * @throws {@link PredictorSDK.ForbiddenError}
24
25
  * @throws {@link PredictorSDK.TooManyRequestsError}
25
26
  * @throws {@link PredictorSDK.ServiceUnavailableError}
@@ -31,8 +32,11 @@ export class PredictorSDKClient {
31
32
  return core.HttpResponsePromise.fromPromise(this.__getSportsMatchingMarkets(request, requestOptions));
32
33
  }
33
34
  async __getSportsMatchingMarkets(request = {}, requestOptions) {
34
- const { kalshiEventTicker, polymarketMarketSlug, predictMarketId, sxbetMarketId } = request;
35
+ const { limit, cursor, includeSettled, kalshiEventTicker, polymarketMarketSlug, predictMarketId, sxbetMarketId, } = request;
35
36
  const _queryParams = {
37
+ limit,
38
+ cursor,
39
+ include_settled: includeSettled,
36
40
  kalshi_event_ticker: kalshiEventTicker,
37
41
  polymarket_market_slug: polymarketMarketSlug,
38
42
  predict_market_id: predictMarketId,
@@ -83,6 +87,14 @@ export class PredictorSDKClient {
83
87
  skipValidation: true,
84
88
  breadcrumbsPrefix: ["response"],
85
89
  }), _response.rawResponse);
90
+ case 402:
91
+ throw new PredictorSDK.PaymentRequiredError(serializers.PaymentRequiredErrorBody.parseOrThrow(_response.error.body, {
92
+ unrecognizedObjectKeys: "passthrough",
93
+ allowUnrecognizedUnionMembers: true,
94
+ allowUnrecognizedEnumValues: true,
95
+ skipValidation: true,
96
+ breadcrumbsPrefix: ["response"],
97
+ }), _response.rawResponse);
86
98
  case 403:
87
99
  throw new PredictorSDK.ForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
88
100
  unrecognizedObjectKeys: "passthrough",
@@ -117,6 +129,118 @@ export class PredictorSDKClient {
117
129
  }
118
130
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/matching-markets/sports");
119
131
  }
132
+ /**
133
+ * Returns a paginated list of unified markets from all supported prediction market providers. Uses cursor-based pagination with default `limit=25`, max `100`.
134
+ *
135
+ * @param {PredictorSDK.GetMarketsRequest} request
136
+ * @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
137
+ *
138
+ * @throws {@link PredictorSDK.BadRequestError}
139
+ * @throws {@link PredictorSDK.UnauthorizedError}
140
+ * @throws {@link PredictorSDK.PaymentRequiredError}
141
+ * @throws {@link PredictorSDK.ForbiddenError}
142
+ * @throws {@link PredictorSDK.TooManyRequestsError}
143
+ * @throws {@link PredictorSDK.ServiceUnavailableError}
144
+ *
145
+ * @example
146
+ * await client.getMarkets()
147
+ */
148
+ getMarkets(request = {}, requestOptions) {
149
+ return core.HttpResponsePromise.fromPromise(this.__getMarkets(request, requestOptions));
150
+ }
151
+ async __getMarkets(request = {}, requestOptions) {
152
+ const { limit, cursor } = request;
153
+ const _queryParams = {
154
+ limit,
155
+ cursor,
156
+ };
157
+ const _authRequest = await this._options.authProvider.getAuthRequest();
158
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
159
+ const _response = await core.fetcher({
160
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
161
+ (await core.Supplier.get(this._options.environment)) ??
162
+ environments.PredictorSDKEnvironment.Production, "v1/markets"),
163
+ method: "GET",
164
+ headers: _headers,
165
+ queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
166
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
167
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
168
+ abortSignal: requestOptions?.abortSignal,
169
+ fetchFn: this._options?.fetch,
170
+ logging: this._options.logging,
171
+ });
172
+ if (_response.ok) {
173
+ return {
174
+ data: serializers.MarketsListResponse.parseOrThrow(_response.body, {
175
+ unrecognizedObjectKeys: "passthrough",
176
+ allowUnrecognizedUnionMembers: true,
177
+ allowUnrecognizedEnumValues: true,
178
+ skipValidation: true,
179
+ breadcrumbsPrefix: ["response"],
180
+ }),
181
+ rawResponse: _response.rawResponse,
182
+ };
183
+ }
184
+ if (_response.error.reason === "status-code") {
185
+ switch (_response.error.statusCode) {
186
+ case 400:
187
+ throw new PredictorSDK.BadRequestError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
188
+ unrecognizedObjectKeys: "passthrough",
189
+ allowUnrecognizedUnionMembers: true,
190
+ allowUnrecognizedEnumValues: true,
191
+ skipValidation: true,
192
+ breadcrumbsPrefix: ["response"],
193
+ }), _response.rawResponse);
194
+ case 401:
195
+ throw new PredictorSDK.UnauthorizedError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
196
+ unrecognizedObjectKeys: "passthrough",
197
+ allowUnrecognizedUnionMembers: true,
198
+ allowUnrecognizedEnumValues: true,
199
+ skipValidation: true,
200
+ breadcrumbsPrefix: ["response"],
201
+ }), _response.rawResponse);
202
+ case 402:
203
+ throw new PredictorSDK.PaymentRequiredError(serializers.PaymentRequiredErrorBody.parseOrThrow(_response.error.body, {
204
+ unrecognizedObjectKeys: "passthrough",
205
+ allowUnrecognizedUnionMembers: true,
206
+ allowUnrecognizedEnumValues: true,
207
+ skipValidation: true,
208
+ breadcrumbsPrefix: ["response"],
209
+ }), _response.rawResponse);
210
+ case 403:
211
+ throw new PredictorSDK.ForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
212
+ unrecognizedObjectKeys: "passthrough",
213
+ allowUnrecognizedUnionMembers: true,
214
+ allowUnrecognizedEnumValues: true,
215
+ skipValidation: true,
216
+ breadcrumbsPrefix: ["response"],
217
+ }), _response.rawResponse);
218
+ case 429:
219
+ throw new PredictorSDK.TooManyRequestsError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
220
+ unrecognizedObjectKeys: "passthrough",
221
+ allowUnrecognizedUnionMembers: true,
222
+ allowUnrecognizedEnumValues: true,
223
+ skipValidation: true,
224
+ breadcrumbsPrefix: ["response"],
225
+ }), _response.rawResponse);
226
+ case 503:
227
+ throw new PredictorSDK.ServiceUnavailableError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
228
+ unrecognizedObjectKeys: "passthrough",
229
+ allowUnrecognizedUnionMembers: true,
230
+ allowUnrecognizedEnumValues: true,
231
+ skipValidation: true,
232
+ breadcrumbsPrefix: ["response"],
233
+ }), _response.rawResponse);
234
+ default:
235
+ throw new errors.PredictorSDKError({
236
+ statusCode: _response.error.statusCode,
237
+ body: _response.error.body,
238
+ rawResponse: _response.rawResponse,
239
+ });
240
+ }
241
+ }
242
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/markets");
243
+ }
120
244
  /**
121
245
  * Returns per-second price data for a Binance trading pair. When called without a time range, returns the latest price. With `start_time` and `end_time`, returns historical per-second prices in newest-first order. Supports cursor-based pagination for large result sets. Unknown or invalid symbols return `200` with `{"prices":[]}` and omit `total`.
122
246
  *
@@ -125,6 +249,7 @@ export class PredictorSDKClient {
125
249
  *
126
250
  * @throws {@link PredictorSDK.BadRequestError}
127
251
  * @throws {@link PredictorSDK.UnauthorizedError}
252
+ * @throws {@link PredictorSDK.PaymentRequiredError}
128
253
  * @throws {@link PredictorSDK.ForbiddenError}
129
254
  * @throws {@link PredictorSDK.TooManyRequestsError}
130
255
  * @throws {@link PredictorSDK.BadGatewayError}
@@ -192,6 +317,14 @@ export class PredictorSDKClient {
192
317
  skipValidation: true,
193
318
  breadcrumbsPrefix: ["response"],
194
319
  }), _response.rawResponse);
320
+ case 402:
321
+ throw new PredictorSDK.PaymentRequiredError(serializers.PaymentRequiredErrorBody.parseOrThrow(_response.error.body, {
322
+ unrecognizedObjectKeys: "passthrough",
323
+ allowUnrecognizedUnionMembers: true,
324
+ allowUnrecognizedEnumValues: true,
325
+ skipValidation: true,
326
+ breadcrumbsPrefix: ["response"],
327
+ }), _response.rawResponse);
195
328
  case 403:
196
329
  throw new PredictorSDK.ForbiddenError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
197
330
  unrecognizedObjectKeys: "passthrough",
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface GetMarketsRequest {
6
+ /** Maximum number of markets to return per page. Range 1–100, default 25. */
7
+ limit?: number;
8
+ /** Opaque cursor from a previous response's `pagination.nextCursor` in the SDKs (raw JSON: `pagination.next_cursor`). */
9
+ cursor?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -3,12 +3,18 @@
3
3
  * {}
4
4
  */
5
5
  export interface GetSportsMatchingMarketsRequest {
6
- /** Kalshi event ticker(s) to find matching markets for (e.g. `KXNFLGAME-25AUG16ARIDEN`). Provide the parameter multiple times for multiple tickers. Only one filter type may be used per request. */
6
+ /** Maximum number of matched events to return per page. Range 1–100, default 25. Ignored when a platform-ID filter is supplied. */
7
+ limit?: number;
8
+ /** Opaque cursor from a previous response's `pagination.nextCursor` in the SDKs (raw JSON: `pagination.next_cursor`). Must be used with the same filter set — a cursor from `include_settled=true` cannot be replayed against `include_settled=false` and will return `400`. */
9
+ cursor?: string;
10
+ /** When `true`, include settled/archived events alongside currently live matches. Defaults to `false`. */
11
+ includeSettled?: boolean;
12
+ /** Kalshi event ticker(s) to find matching markets for (e.g. `KXNFLGAME-25AUG16ARIDEN`). Provide the parameter multiple times for multiple tickers. Only one filter type may be used per request. Lookup mode — pagination parameters are ignored. */
7
13
  kalshiEventTicker?: string | string[];
8
- /** Polymarket market slug(s) to find matching markets for (e.g. `nfl-ari-den-2025-08-16`). Provide the parameter multiple times for multiple slugs. Only one filter type may be used per request. */
14
+ /** Polymarket market slug(s) to find matching markets for (e.g. `nfl-ari-den-2025-08-16`). Provide the parameter multiple times for multiple slugs. Only one filter type may be used per request. Lookup mode — pagination parameters are ignored. */
9
15
  polymarketMarketSlug?: string | string[];
10
- /** Predict market ID(s) to find matching markets for (e.g. `110629`). Provide the parameter multiple times for multiple IDs. Only one filter type may be used per request. */
16
+ /** Predict market ID(s) to find matching markets for (e.g. `110629`). Provide the parameter multiple times for multiple IDs. Only one filter type may be used per request. Lookup mode — pagination parameters are ignored. */
11
17
  predictMarketId?: string | string[];
12
- /** SX Bet market ID(s) to find matching markets for (e.g. `0x4c000abdbf197ef32ecdf15561b1d636f1e5b02629f466678757fd83e2ec3599`). Provide the parameter multiple times for multiple IDs. Only one filter type may be used per request. */
18
+ /** SX Bet market ID(s) to find matching markets for (e.g. `0x4c000abdbf197ef32ecdf15561b1d636f1e5b02629f466678757fd83e2ec3599`). Provide the parameter multiple times for multiple IDs. Only one filter type may be used per request. Lookup mode — pagination parameters are ignored. */
13
19
  sxbetMarketId?: string | string[];
14
20
  }
@@ -1,2 +1,3 @@
1
1
  export type { GetBinanceCryptoPricesRequest } from "./GetBinanceCryptoPricesRequest.js";
2
+ export type { GetMarketsRequest } from "./GetMarketsRequest.js";
2
3
  export type { GetSportsMatchingMarketsRequest } from "./GetSportsMatchingMarketsRequest.js";
@@ -2,5 +2,6 @@ import type * as core from "../../core/index.js";
2
2
  import * as errors from "../../errors/index.js";
3
3
  import type * as PredictorSDK from "../index.js";
4
4
  export declare class BadGatewayError extends errors.PredictorSDKError {
5
+ readonly body: PredictorSDK.ErrorResponse;
5
6
  constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
7
  }
@@ -2,5 +2,6 @@ import type * as core from "../../core/index.js";
2
2
  import * as errors from "../../errors/index.js";
3
3
  import type * as PredictorSDK from "../index.js";
4
4
  export declare class BadRequestError extends errors.PredictorSDKError {
5
+ readonly body: PredictorSDK.ErrorResponse;
5
6
  constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
7
  }
@@ -2,5 +2,6 @@ import type * as core from "../../core/index.js";
2
2
  import * as errors from "../../errors/index.js";
3
3
  import type * as PredictorSDK from "../index.js";
4
4
  export declare class ForbiddenError extends errors.PredictorSDKError {
5
+ readonly body: PredictorSDK.ErrorResponse;
5
6
  constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
7
  }
@@ -0,0 +1,7 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as PredictorSDK from "../index.js";
4
+ export declare class PaymentRequiredError extends errors.PredictorSDKError {
5
+ readonly body: PredictorSDK.PaymentRequiredErrorBody;
6
+ constructor(body: PredictorSDK.PaymentRequiredErrorBody, rawResponse?: core.RawResponse);
7
+ }
@@ -0,0 +1,17 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as errors from "../../errors/index.js";
3
+ export class PaymentRequiredError extends errors.PredictorSDKError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "PaymentRequiredError",
7
+ statusCode: 402,
8
+ body: body,
9
+ rawResponse: rawResponse,
10
+ });
11
+ Object.setPrototypeOf(this, new.target.prototype);
12
+ if (Error.captureStackTrace) {
13
+ Error.captureStackTrace(this, this.constructor);
14
+ }
15
+ this.name = this.constructor.name;
16
+ }
17
+ }
@@ -2,5 +2,6 @@ import type * as core from "../../core/index.js";
2
2
  import * as errors from "../../errors/index.js";
3
3
  import type * as PredictorSDK from "../index.js";
4
4
  export declare class ServiceUnavailableError extends errors.PredictorSDKError {
5
+ readonly body: PredictorSDK.ErrorResponse;
5
6
  constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
7
  }
@@ -2,5 +2,6 @@ import type * as core from "../../core/index.js";
2
2
  import * as errors from "../../errors/index.js";
3
3
  import type * as PredictorSDK from "../index.js";
4
4
  export declare class TooManyRequestsError extends errors.PredictorSDKError {
5
+ readonly body: PredictorSDK.ErrorResponse;
5
6
  constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
7
  }
@@ -2,5 +2,6 @@ import type * as core from "../../core/index.js";
2
2
  import * as errors from "../../errors/index.js";
3
3
  import type * as PredictorSDK from "../index.js";
4
4
  export declare class UnauthorizedError extends errors.PredictorSDKError {
5
+ readonly body: PredictorSDK.ErrorResponse;
5
6
  constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
7
  }
@@ -1,6 +1,7 @@
1
1
  export * from "./BadGatewayError.js";
2
2
  export * from "./BadRequestError.js";
3
3
  export * from "./ForbiddenError.js";
4
+ export * from "./PaymentRequiredError.js";
4
5
  export * from "./ServiceUnavailableError.js";
5
6
  export * from "./TooManyRequestsError.js";
6
7
  export * from "./UnauthorizedError.js";
@@ -1,6 +1,7 @@
1
1
  export * from "./BadGatewayError.js";
2
2
  export * from "./BadRequestError.js";
3
3
  export * from "./ForbiddenError.js";
4
+ export * from "./PaymentRequiredError.js";
4
5
  export * from "./ServiceUnavailableError.js";
5
6
  export * from "./TooManyRequestsError.js";
6
7
  export * from "./UnauthorizedError.js";
@@ -0,0 +1,7 @@
1
+ import type * as PredictorSDK from "../index.js";
2
+ export interface MarketsListResponse {
3
+ /** Array of markets for the current page. */
4
+ data: PredictorSDK.UnifiedMarket[];
5
+ /** Pagination metadata for the current page. */
6
+ pagination: PredictorSDK.PaginationBlock;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,10 @@
1
+ export interface PaginationBlock {
2
+ /** Number of items requested per page (echoes the `limit` query param). */
3
+ limit: number;
4
+ /** Total matching items across all pages. */
5
+ total: number;
6
+ /** Whether additional pages exist beyond this one. */
7
+ hasMore: boolean;
8
+ /** Opaque cursor for fetching the next page. Pass back via the `cursor` query parameter. Omitted when `has_more` is `false`. Clients must preserve the same filter set when re-using a cursor — mismatches return `400`. */
9
+ nextCursor?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ /** Recommended client action for this 402. */
2
+ export declare const PaymentRequiredErrorAction: {
3
+ readonly UpgradePlan: "upgrade_plan";
4
+ readonly ResolvePayment: "resolve_payment";
5
+ };
6
+ export type PaymentRequiredErrorAction = (typeof PaymentRequiredErrorAction)[keyof typeof PaymentRequiredErrorAction];
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /** Recommended client action for this 402. */
3
+ export const PaymentRequiredErrorAction = {
4
+ UpgradePlan: "upgrade_plan",
5
+ ResolvePayment: "resolve_payment",
6
+ };
@@ -0,0 +1,20 @@
1
+ import type * as PredictorSDK from "../index.js";
2
+ /**
3
+ * Error body returned with HTTP 402. The `action` discriminator lets clients route to the correct recovery flow: `upgrade_plan` means the caller is on a lower tier than the endpoint requires, or the Free monthly allowance is exhausted; `resolve_payment` means the caller had a paid subscription that entered a payment-recovery state (past_due/unpaid/paused/incomplete) and the backend has already downgraded them to Free — the fix is in the billing portal, not a new purchase. `required_tier` / `current_tier` are always populated; `included_requests_per_month` and `current_period_requests` are only set when a Free caller hits the monthly allowance.
4
+ */
5
+ export interface PaymentRequiredErrorBody {
6
+ error: string;
7
+ /** Additional detail about the error. */
8
+ message?: string;
9
+ statusCode: number;
10
+ /** Recommended client action for this 402. */
11
+ action: PredictorSDK.PaymentRequiredErrorAction;
12
+ /** Billing tier that would satisfy the gate (e.g. `starter`, `pro`, `business`, `enterprise`). */
13
+ requiredTier: string;
14
+ /** Billing tier currently associated with the caller. */
15
+ currentTier: string;
16
+ /** Monthly Free-tier allowance. Present only when the 402 is caused by the Free cap. */
17
+ includedRequestsPerMonth?: number;
18
+ /** Requests the Free caller has made in the current calendar month. Present only when the 402 is caused by the Free cap. */
19
+ currentPeriodRequests?: number;
20
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -2,4 +2,6 @@ import type * as PredictorSDK from "../index.js";
2
2
  export interface SportsMatchingResponse {
3
3
  /** Key-value pairs where each key is the queried identifier (Kalshi event ticker, Polymarket slug, or canonical event ID when no filter is provided) and each value is an array of platform market objects. */
4
4
  markets: Record<string, PredictorSDK.PlatformMarket[]>;
5
+ /** Pagination metadata for the current page. Present in list mode (no platform-ID filter). Absent in lookup mode since the response is bounded by the filter. */
6
+ pagination?: PredictorSDK.PaginationBlock;
5
7
  }
@@ -0,0 +1,9 @@
1
+ import type * as PredictorSDK from "../index.js";
2
+ export interface UnifiedMarket {
3
+ /** Composite market identifier in the format `{provider}:{provider_id}` (e.g. `kalshi:KXNBAGAME-26MAR06INDLAL-LAL`). */
4
+ id: string;
5
+ /** Prediction market provider. */
6
+ provider: PredictorSDK.UnifiedMarketProvider;
7
+ /** Human-readable market title/question. */
8
+ title: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ /** Prediction market provider. */
2
+ export declare const UnifiedMarketProvider: {
3
+ readonly Kalshi: "kalshi";
4
+ readonly Polymarket: "polymarket";
5
+ readonly Predict: "predict";
6
+ readonly Sxbet: "sxbet";
7
+ };
8
+ export type UnifiedMarketProvider = (typeof UnifiedMarketProvider)[keyof typeof UnifiedMarketProvider];
@@ -0,0 +1,8 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /** Prediction market provider. */
3
+ export const UnifiedMarketProvider = {
4
+ Kalshi: "kalshi",
5
+ Polymarket: "polymarket",
6
+ Predict: "predict",
7
+ Sxbet: "sxbet",
8
+ };
@@ -1,6 +1,12 @@
1
1
  export * from "./CryptoPriceItem.js";
2
2
  export * from "./CryptoPricesResponse.js";
3
3
  export * from "./ErrorResponse.js";
4
+ export * from "./MarketsListResponse.js";
5
+ export * from "./PaginationBlock.js";
6
+ export * from "./PaymentRequiredErrorAction.js";
7
+ export * from "./PaymentRequiredErrorBody.js";
4
8
  export * from "./PlatformMarket.js";
5
9
  export * from "./PlatformMarketPlatform.js";
6
10
  export * from "./SportsMatchingResponse.js";
11
+ export * from "./UnifiedMarket.js";
12
+ export * from "./UnifiedMarketProvider.js";
@@ -1,6 +1,12 @@
1
1
  export * from "./CryptoPriceItem.js";
2
2
  export * from "./CryptoPricesResponse.js";
3
3
  export * from "./ErrorResponse.js";
4
+ export * from "./MarketsListResponse.js";
5
+ export * from "./PaginationBlock.js";
6
+ export * from "./PaymentRequiredErrorAction.js";
7
+ export * from "./PaymentRequiredErrorBody.js";
4
8
  export * from "./PlatformMarket.js";
5
9
  export * from "./PlatformMarketPlatform.js";
6
10
  export * from "./SportsMatchingResponse.js";
11
+ export * from "./UnifiedMarket.js";
12
+ export * from "./UnifiedMarketProvider.js";
@@ -0,0 +1,12 @@
1
+ import type * as PredictorSDK from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ import { PaginationBlock } from "./PaginationBlock.js";
5
+ import { UnifiedMarket } from "./UnifiedMarket.js";
6
+ export declare const MarketsListResponse: core.serialization.ObjectSchema<serializers.MarketsListResponse.Raw, PredictorSDK.MarketsListResponse>;
7
+ export declare namespace MarketsListResponse {
8
+ interface Raw {
9
+ data: UnifiedMarket.Raw[];
10
+ pagination: PaginationBlock.Raw;
11
+ }
12
+ }
@@ -0,0 +1,8 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.js";
3
+ import { PaginationBlock } from "./PaginationBlock.js";
4
+ import { UnifiedMarket } from "./UnifiedMarket.js";
5
+ export const MarketsListResponse = core.serialization.object({
6
+ data: core.serialization.list(UnifiedMarket),
7
+ pagination: PaginationBlock,
8
+ });
@@ -0,0 +1,12 @@
1
+ import type * as PredictorSDK from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ export declare const PaginationBlock: core.serialization.ObjectSchema<serializers.PaginationBlock.Raw, PredictorSDK.PaginationBlock>;
5
+ export declare namespace PaginationBlock {
6
+ interface Raw {
7
+ limit: number;
8
+ total: number;
9
+ has_more: boolean;
10
+ next_cursor?: string | null;
11
+ }
12
+ }
@@ -0,0 +1,8 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.js";
3
+ export const PaginationBlock = core.serialization.object({
4
+ limit: core.serialization.number(),
5
+ total: core.serialization.number(),
6
+ hasMore: core.serialization.property("has_more", core.serialization.boolean()),
7
+ nextCursor: core.serialization.property("next_cursor", core.serialization.string().optional()),
8
+ });
@@ -0,0 +1,7 @@
1
+ import type * as PredictorSDK from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ export declare const PaymentRequiredErrorAction: core.serialization.Schema<serializers.PaymentRequiredErrorAction.Raw, PredictorSDK.PaymentRequiredErrorAction>;
5
+ export declare namespace PaymentRequiredErrorAction {
6
+ type Raw = "upgrade_plan" | "resolve_payment";
7
+ }
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.js";
3
+ export const PaymentRequiredErrorAction = core.serialization.enum_(["upgrade_plan", "resolve_payment"]);
@@ -0,0 +1,17 @@
1
+ import type * as PredictorSDK from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ import { PaymentRequiredErrorAction } from "./PaymentRequiredErrorAction.js";
5
+ export declare const PaymentRequiredErrorBody: core.serialization.ObjectSchema<serializers.PaymentRequiredErrorBody.Raw, PredictorSDK.PaymentRequiredErrorBody>;
6
+ export declare namespace PaymentRequiredErrorBody {
7
+ interface Raw {
8
+ error: string;
9
+ message?: string | null;
10
+ status_code: number;
11
+ action: PaymentRequiredErrorAction.Raw;
12
+ required_tier: string;
13
+ current_tier: string;
14
+ included_requests_per_month?: number | null;
15
+ current_period_requests?: number | null;
16
+ }
17
+ }
@@ -0,0 +1,13 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.js";
3
+ import { PaymentRequiredErrorAction } from "./PaymentRequiredErrorAction.js";
4
+ export const PaymentRequiredErrorBody = core.serialization.object({
5
+ error: core.serialization.string(),
6
+ message: core.serialization.string().optional(),
7
+ statusCode: core.serialization.property("status_code", core.serialization.number()),
8
+ action: PaymentRequiredErrorAction,
9
+ requiredTier: core.serialization.property("required_tier", core.serialization.string()),
10
+ currentTier: core.serialization.property("current_tier", core.serialization.string()),
11
+ includedRequestsPerMonth: core.serialization.property("included_requests_per_month", core.serialization.number().optional()),
12
+ currentPeriodRequests: core.serialization.property("current_period_requests", core.serialization.number().optional()),
13
+ });
@@ -1,10 +1,12 @@
1
1
  import type * as PredictorSDK from "../../api/index.js";
2
2
  import * as core from "../../core/index.js";
3
3
  import type * as serializers from "../index.js";
4
+ import { PaginationBlock } from "./PaginationBlock.js";
4
5
  import { PlatformMarket } from "./PlatformMarket.js";
5
6
  export declare const SportsMatchingResponse: core.serialization.ObjectSchema<serializers.SportsMatchingResponse.Raw, PredictorSDK.SportsMatchingResponse>;
6
7
  export declare namespace SportsMatchingResponse {
7
8
  interface Raw {
8
9
  markets: Record<string, PlatformMarket.Raw[]>;
10
+ pagination?: PaginationBlock.Raw | null;
9
11
  }
10
12
  }
@@ -1,6 +1,8 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  import * as core from "../../core/index.js";
3
+ import { PaginationBlock } from "./PaginationBlock.js";
3
4
  import { PlatformMarket } from "./PlatformMarket.js";
4
5
  export const SportsMatchingResponse = core.serialization.object({
5
6
  markets: core.serialization.record(core.serialization.string(), core.serialization.list(PlatformMarket)),
7
+ pagination: PaginationBlock.optional(),
6
8
  });
@@ -0,0 +1,12 @@
1
+ import type * as PredictorSDK from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ import { UnifiedMarketProvider } from "./UnifiedMarketProvider.js";
5
+ export declare const UnifiedMarket: core.serialization.ObjectSchema<serializers.UnifiedMarket.Raw, PredictorSDK.UnifiedMarket>;
6
+ export declare namespace UnifiedMarket {
7
+ interface Raw {
8
+ id: string;
9
+ provider: UnifiedMarketProvider.Raw;
10
+ title: string;
11
+ }
12
+ }
@@ -0,0 +1,8 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.js";
3
+ import { UnifiedMarketProvider } from "./UnifiedMarketProvider.js";
4
+ export const UnifiedMarket = core.serialization.object({
5
+ id: core.serialization.string(),
6
+ provider: UnifiedMarketProvider,
7
+ title: core.serialization.string(),
8
+ });
@@ -0,0 +1,7 @@
1
+ import type * as PredictorSDK from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ export declare const UnifiedMarketProvider: core.serialization.Schema<serializers.UnifiedMarketProvider.Raw, PredictorSDK.UnifiedMarketProvider>;
5
+ export declare namespace UnifiedMarketProvider {
6
+ type Raw = "kalshi" | "polymarket" | "predict" | "sxbet";
7
+ }
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.js";
3
+ export const UnifiedMarketProvider = core.serialization.enum_(["kalshi", "polymarket", "predict", "sxbet"]);
@@ -1,6 +1,12 @@
1
1
  export * from "./CryptoPriceItem.js";
2
2
  export * from "./CryptoPricesResponse.js";
3
3
  export * from "./ErrorResponse.js";
4
+ export * from "./MarketsListResponse.js";
5
+ export * from "./PaginationBlock.js";
6
+ export * from "./PaymentRequiredErrorAction.js";
7
+ export * from "./PaymentRequiredErrorBody.js";
4
8
  export * from "./PlatformMarket.js";
5
9
  export * from "./PlatformMarketPlatform.js";
6
10
  export * from "./SportsMatchingResponse.js";
11
+ export * from "./UnifiedMarket.js";
12
+ export * from "./UnifiedMarketProvider.js";
@@ -1,6 +1,12 @@
1
1
  export * from "./CryptoPriceItem.js";
2
2
  export * from "./CryptoPricesResponse.js";
3
3
  export * from "./ErrorResponse.js";
4
+ export * from "./MarketsListResponse.js";
5
+ export * from "./PaginationBlock.js";
6
+ export * from "./PaymentRequiredErrorAction.js";
7
+ export * from "./PaymentRequiredErrorBody.js";
4
8
  export * from "./PlatformMarket.js";
5
9
  export * from "./PlatformMarketPlatform.js";
6
10
  export * from "./SportsMatchingResponse.js";
11
+ export * from "./UnifiedMarket.js";
12
+ export * from "./UnifiedMarketProvider.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predictorsdk/client",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "The official TypeScript/JavaScript client for the PredictorSDK matching markets API",
5
5
  "license": "MIT",
6
6
  "keywords": [