@predictorsdk/client 0.1.0

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 (133) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -0
  3. package/dist/BaseClient.d.ts +39 -0
  4. package/dist/BaseClient.js +28 -0
  5. package/dist/Client.d.ts +41 -0
  6. package/dist/Client.js +101 -0
  7. package/dist/api/client/index.d.ts +1 -0
  8. package/dist/api/client/index.js +1 -0
  9. package/dist/api/client/requests/GetSportsMatchingMarketsRequest.d.ts +14 -0
  10. package/dist/api/client/requests/GetSportsMatchingMarketsRequest.js +2 -0
  11. package/dist/api/client/requests/index.d.ts +1 -0
  12. package/dist/api/client/requests/index.js +1 -0
  13. package/dist/api/errors/BadRequestError.d.ts +6 -0
  14. package/dist/api/errors/BadRequestError.js +17 -0
  15. package/dist/api/errors/ForbiddenError.d.ts +6 -0
  16. package/dist/api/errors/ForbiddenError.js +17 -0
  17. package/dist/api/errors/ServiceUnavailableError.d.ts +6 -0
  18. package/dist/api/errors/ServiceUnavailableError.js +17 -0
  19. package/dist/api/errors/TooManyRequestsError.d.ts +6 -0
  20. package/dist/api/errors/TooManyRequestsError.js +17 -0
  21. package/dist/api/errors/UnauthorizedError.d.ts +6 -0
  22. package/dist/api/errors/UnauthorizedError.js +17 -0
  23. package/dist/api/errors/index.d.ts +5 -0
  24. package/dist/api/errors/index.js +5 -0
  25. package/dist/api/index.d.ts +3 -0
  26. package/dist/api/index.js +3 -0
  27. package/dist/api/types/ErrorResponse.d.ts +4 -0
  28. package/dist/api/types/ErrorResponse.js +2 -0
  29. package/dist/api/types/PlatformMarket.d.ts +24 -0
  30. package/dist/api/types/PlatformMarket.js +10 -0
  31. package/dist/api/types/SportsMatchingResponse.d.ts +5 -0
  32. package/dist/api/types/SportsMatchingResponse.js +2 -0
  33. package/dist/api/types/index.d.ts +3 -0
  34. package/dist/api/types/index.js +3 -0
  35. package/dist/auth/BearerAuthProvider.d.ts +20 -0
  36. package/dist/auth/BearerAuthProvider.js +32 -0
  37. package/dist/auth/index.d.ts +1 -0
  38. package/dist/auth/index.js +1 -0
  39. package/dist/core/auth/AuthProvider.d.ts +7 -0
  40. package/dist/core/auth/AuthProvider.js +1 -0
  41. package/dist/core/auth/AuthRequest.d.ts +9 -0
  42. package/dist/core/auth/AuthRequest.js +1 -0
  43. package/dist/core/auth/BasicAuth.d.ts +8 -0
  44. package/dist/core/auth/BasicAuth.js +24 -0
  45. package/dist/core/auth/BearerToken.d.ts +7 -0
  46. package/dist/core/auth/BearerToken.js +13 -0
  47. package/dist/core/auth/NoOpAuthProvider.d.ts +5 -0
  48. package/dist/core/auth/NoOpAuthProvider.js +5 -0
  49. package/dist/core/auth/index.d.ts +5 -0
  50. package/dist/core/auth/index.js +3 -0
  51. package/dist/core/base64.d.ts +2 -0
  52. package/dist/core/base64.js +22 -0
  53. package/dist/core/exports.d.ts +1 -0
  54. package/dist/core/exports.js +1 -0
  55. package/dist/core/fetcher/APIResponse.d.ts +20 -0
  56. package/dist/core/fetcher/APIResponse.js +1 -0
  57. package/dist/core/fetcher/BinaryResponse.d.ts +19 -0
  58. package/dist/core/fetcher/BinaryResponse.js +14 -0
  59. package/dist/core/fetcher/EndpointMetadata.d.ts +13 -0
  60. package/dist/core/fetcher/EndpointMetadata.js +1 -0
  61. package/dist/core/fetcher/EndpointSupplier.d.ts +12 -0
  62. package/dist/core/fetcher/EndpointSupplier.js +10 -0
  63. package/dist/core/fetcher/Fetcher.d.ts +50 -0
  64. package/dist/core/fetcher/Fetcher.js +305 -0
  65. package/dist/core/fetcher/Headers.d.ts +2 -0
  66. package/dist/core/fetcher/Headers.js +83 -0
  67. package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
  68. package/dist/core/fetcher/HttpResponsePromise.js +90 -0
  69. package/dist/core/fetcher/RawResponse.d.ts +29 -0
  70. package/dist/core/fetcher/RawResponse.js +40 -0
  71. package/dist/core/fetcher/Supplier.d.ts +4 -0
  72. package/dist/core/fetcher/Supplier.js +10 -0
  73. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  74. package/dist/core/fetcher/createRequestUrl.js +5 -0
  75. package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
  76. package/dist/core/fetcher/getErrorResponseBody.js +30 -0
  77. package/dist/core/fetcher/getFetchFn.d.ts +1 -0
  78. package/dist/core/fetcher/getFetchFn.js +3 -0
  79. package/dist/core/fetcher/getHeader.d.ts +1 -0
  80. package/dist/core/fetcher/getHeader.js +8 -0
  81. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  82. package/dist/core/fetcher/getRequestBody.js +13 -0
  83. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  84. package/dist/core/fetcher/getResponseBody.js +55 -0
  85. package/dist/core/fetcher/index.d.ts +13 -0
  86. package/dist/core/fetcher/index.js +7 -0
  87. package/dist/core/fetcher/makePassthroughRequest.d.ts +49 -0
  88. package/dist/core/fetcher/makePassthroughRequest.js +119 -0
  89. package/dist/core/fetcher/makeRequest.d.ts +6 -0
  90. package/dist/core/fetcher/makeRequest.js +53 -0
  91. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  92. package/dist/core/fetcher/requestWithRetries.js +53 -0
  93. package/dist/core/fetcher/signals.d.ts +5 -0
  94. package/dist/core/fetcher/signals.js +20 -0
  95. package/dist/core/headers.d.ts +2 -0
  96. package/dist/core/headers.js +27 -0
  97. package/dist/core/index.d.ts +6 -0
  98. package/dist/core/index.js +6 -0
  99. package/dist/core/json.d.ts +15 -0
  100. package/dist/core/json.js +19 -0
  101. package/dist/core/logging/exports.d.ts +18 -0
  102. package/dist/core/logging/exports.js +9 -0
  103. package/dist/core/logging/index.d.ts +1 -0
  104. package/dist/core/logging/index.js +1 -0
  105. package/dist/core/logging/logger.d.ts +126 -0
  106. package/dist/core/logging/logger.js +140 -0
  107. package/dist/core/runtime/index.d.ts +1 -0
  108. package/dist/core/runtime/index.js +1 -0
  109. package/dist/core/runtime/runtime.d.ts +9 -0
  110. package/dist/core/runtime/runtime.js +100 -0
  111. package/dist/core/url/encodePathParam.d.ts +1 -0
  112. package/dist/core/url/encodePathParam.js +18 -0
  113. package/dist/core/url/index.d.ts +3 -0
  114. package/dist/core/url/index.js +3 -0
  115. package/dist/core/url/join.d.ts +1 -0
  116. package/dist/core/url/join.js +65 -0
  117. package/dist/core/url/qs.d.ts +6 -0
  118. package/dist/core/url/qs.js +64 -0
  119. package/dist/environments.d.ts +4 -0
  120. package/dist/environments.js +4 -0
  121. package/dist/errors/PredictorSDKError.d.ts +14 -0
  122. package/dist/errors/PredictorSDKError.js +35 -0
  123. package/dist/errors/PredictorSDKTimeoutError.d.ts +6 -0
  124. package/dist/errors/PredictorSDKTimeoutError.js +15 -0
  125. package/dist/errors/handleNonStatusCodeError.d.ts +2 -0
  126. package/dist/errors/handleNonStatusCodeError.js +32 -0
  127. package/dist/errors/index.d.ts +2 -0
  128. package/dist/errors/index.js +2 -0
  129. package/dist/exports.d.ts +1 -0
  130. package/dist/exports.js +1 -0
  131. package/dist/index.d.ts +6 -0
  132. package/dist/index.js +5 -0
  133. package/package.json +42 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PredictorSDK
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # @predictorsdk/client
2
+
3
+ The official TypeScript/JavaScript client for the [PredictorSDK](https://predictorsdk.com) matching markets API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @predictorsdk/client
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { PredictorSDKClient } from "@predictorsdk/client";
15
+
16
+ const client = new PredictorSDKClient({ token: "your-api-key" });
17
+
18
+ const { markets } = await client.getSportsMatchingMarkets({
19
+ kalshi_event_ticker: "KXMLB-25-NYM-COL-2025-04-03",
20
+ });
21
+ ```
22
+
23
+ ## Documentation
24
+
25
+ - [Docs](https://docs.predictorsdk.com)
26
+ - [API Reference](https://docs.predictorsdk.com/api-reference)
27
+
28
+ ## License
29
+
30
+ [MIT](https://github.com/PredictorSDK/sdk-typescript/blob/main/LICENSE)
@@ -0,0 +1,39 @@
1
+ import { BearerAuthProvider } from "./auth/BearerAuthProvider.js";
2
+ import * as core from "./core/index.js";
3
+ import type * as environments from "./environments.js";
4
+ export type BaseClientOptions = {
5
+ environment?: core.Supplier<environments.PredictorSDKEnvironment | string>;
6
+ /** Specify a custom URL to connect the client to. */
7
+ baseUrl?: core.Supplier<string>;
8
+ /** Additional headers to include in requests. */
9
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
10
+ /** The default maximum time to wait for a response in seconds. */
11
+ timeoutInSeconds?: number;
12
+ /** The default number of times to retry the request. Defaults to 2. */
13
+ maxRetries?: number;
14
+ /** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
15
+ fetch?: typeof fetch;
16
+ /** Configure logging for the client. */
17
+ logging?: core.logging.LogConfig | core.logging.Logger;
18
+ } & BearerAuthProvider.AuthOptions;
19
+ export interface BaseRequestOptions {
20
+ /** The maximum time to wait for a response in seconds. */
21
+ timeoutInSeconds?: number;
22
+ /** The number of times to retry the request. Defaults to 2. */
23
+ maxRetries?: number;
24
+ /** A hook to abort the request. */
25
+ abortSignal?: AbortSignal;
26
+ /** Additional query string parameters to include in the request. */
27
+ queryParams?: Record<string, unknown>;
28
+ /** Additional headers to include in the request. */
29
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
30
+ }
31
+ export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
32
+ logging: core.logging.Logger;
33
+ authProvider?: core.AuthProvider;
34
+ };
35
+ export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
36
+ authProvider: core.AuthProvider;
37
+ };
38
+ export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
39
+ export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
@@ -0,0 +1,28 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import { BearerAuthProvider } from "./auth/BearerAuthProvider.js";
3
+ import { mergeHeaders } from "./core/headers.js";
4
+ import * as core from "./core/index.js";
5
+ export function normalizeClientOptions(options) {
6
+ const headers = mergeHeaders({
7
+ "X-Fern-Language": "JavaScript",
8
+ "X-Fern-Runtime": core.RUNTIME.type,
9
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
10
+ }, options?.headers);
11
+ return {
12
+ ...options,
13
+ logging: core.logging.createLogger(options?.logging),
14
+ headers,
15
+ };
16
+ }
17
+ export function normalizeClientOptionsWithAuth(options) {
18
+ const normalized = normalizeClientOptions(options);
19
+ const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
20
+ normalized.authProvider ??= new BearerAuthProvider(normalizedWithNoOpAuthProvider);
21
+ return normalized;
22
+ }
23
+ function withNoOpAuthProvider(options) {
24
+ return {
25
+ ...options,
26
+ authProvider: new core.NoOpAuthProvider(),
27
+ };
28
+ }
@@ -0,0 +1,41 @@
1
+ import * as PredictorSDK from "./api/index.js";
2
+ import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
3
+ import { type NormalizedClientOptionsWithAuth } from "./BaseClient.js";
4
+ import * as core from "./core/index.js";
5
+ export declare namespace PredictorSDKClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class PredictorSDKClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<PredictorSDKClient.Options>;
12
+ constructor(options: PredictorSDKClient.Options);
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.
15
+ *
16
+ * @param {PredictorSDK.GetSportsMatchingMarketsRequest} request
17
+ * @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link PredictorSDK.BadRequestError}
20
+ * @throws {@link PredictorSDK.UnauthorizedError}
21
+ * @throws {@link PredictorSDK.ForbiddenError}
22
+ * @throws {@link PredictorSDK.TooManyRequestsError}
23
+ * @throws {@link PredictorSDK.ServiceUnavailableError}
24
+ *
25
+ * @example
26
+ * await client.getSportsMatchingMarkets()
27
+ */
28
+ getSportsMatchingMarkets(request?: PredictorSDK.GetSportsMatchingMarketsRequest, requestOptions?: PredictorSDKClient.RequestOptions): core.HttpResponsePromise<PredictorSDK.SportsMatchingResponse>;
29
+ private __getSportsMatchingMarkets;
30
+ /**
31
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
32
+ * This is useful for making requests to endpoints not yet supported in the SDK.
33
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
34
+ *
35
+ * @param {Request | string | URL} input - The URL, path, or Request object.
36
+ * @param {RequestInit} init - Standard fetch RequestInit options.
37
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
38
+ * @returns {Promise<Response>} A standard Response object.
39
+ */
40
+ fetch(input: Request | string | URL, init?: RequestInit, requestOptions?: core.PassthroughRequest.RequestOptions): Promise<Response>;
41
+ }
package/dist/Client.js ADDED
@@ -0,0 +1,101 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as PredictorSDK from "./api/index.js";
3
+ import { normalizeClientOptionsWithAuth } from "./BaseClient.js";
4
+ import { mergeHeaders } from "./core/headers.js";
5
+ import * as core from "./core/index.js";
6
+ import * as environments from "./environments.js";
7
+ import { handleNonStatusCodeError } from "./errors/handleNonStatusCodeError.js";
8
+ import * as errors from "./errors/index.js";
9
+ export class PredictorSDKClient {
10
+ _options;
11
+ constructor(options) {
12
+ this._options = normalizeClientOptionsWithAuth(options);
13
+ }
14
+ /**
15
+ * 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
+ *
17
+ * @param {PredictorSDK.GetSportsMatchingMarketsRequest} request
18
+ * @param {PredictorSDKClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @throws {@link PredictorSDK.BadRequestError}
21
+ * @throws {@link PredictorSDK.UnauthorizedError}
22
+ * @throws {@link PredictorSDK.ForbiddenError}
23
+ * @throws {@link PredictorSDK.TooManyRequestsError}
24
+ * @throws {@link PredictorSDK.ServiceUnavailableError}
25
+ *
26
+ * @example
27
+ * await client.getSportsMatchingMarkets()
28
+ */
29
+ getSportsMatchingMarkets(request = {}, requestOptions) {
30
+ return core.HttpResponsePromise.fromPromise(this.__getSportsMatchingMarkets(request, requestOptions));
31
+ }
32
+ async __getSportsMatchingMarkets(request = {}, requestOptions) {
33
+ const { kalshi_event_ticker: kalshiEventTicker, polymarket_market_slug: polymarketMarketSlug, predict_market_id: predictMarketId, sxbet_market_id: sxbetMarketId, } = request;
34
+ const _queryParams = {
35
+ kalshi_event_ticker: kalshiEventTicker,
36
+ polymarket_market_slug: polymarketMarketSlug,
37
+ predict_market_id: predictMarketId,
38
+ sxbet_market_id: sxbetMarketId,
39
+ };
40
+ const _authRequest = await this._options.authProvider.getAuthRequest();
41
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
42
+ const _response = await core.fetcher({
43
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
44
+ (await core.Supplier.get(this._options.environment)) ??
45
+ environments.PredictorSDKEnvironment.Production, "v1/matching-markets/sports"),
46
+ method: "GET",
47
+ headers: _headers,
48
+ queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
49
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
50
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
51
+ abortSignal: requestOptions?.abortSignal,
52
+ fetchFn: this._options?.fetch,
53
+ logging: this._options.logging,
54
+ });
55
+ if (_response.ok) {
56
+ return { data: _response.body, rawResponse: _response.rawResponse };
57
+ }
58
+ if (_response.error.reason === "status-code") {
59
+ switch (_response.error.statusCode) {
60
+ case 400:
61
+ throw new PredictorSDK.BadRequestError(_response.error.body, _response.rawResponse);
62
+ case 401:
63
+ throw new PredictorSDK.UnauthorizedError(_response.error.body, _response.rawResponse);
64
+ case 403:
65
+ throw new PredictorSDK.ForbiddenError(_response.error.body, _response.rawResponse);
66
+ case 429:
67
+ throw new PredictorSDK.TooManyRequestsError(_response.error.body, _response.rawResponse);
68
+ case 503:
69
+ throw new PredictorSDK.ServiceUnavailableError(_response.error.body, _response.rawResponse);
70
+ default:
71
+ throw new errors.PredictorSDKError({
72
+ statusCode: _response.error.statusCode,
73
+ body: _response.error.body,
74
+ rawResponse: _response.rawResponse,
75
+ });
76
+ }
77
+ }
78
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/matching-markets/sports");
79
+ }
80
+ /**
81
+ * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
82
+ * This is useful for making requests to endpoints not yet supported in the SDK.
83
+ * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL.
84
+ *
85
+ * @param {Request | string | URL} input - The URL, path, or Request object.
86
+ * @param {RequestInit} init - Standard fetch RequestInit options.
87
+ * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal).
88
+ * @returns {Promise<Response>} A standard Response object.
89
+ */
90
+ async fetch(input, init, requestOptions) {
91
+ return core.makePassthroughRequest(input, init, {
92
+ baseUrl: this._options.baseUrl ?? this._options.environment,
93
+ headers: this._options.headers,
94
+ timeoutInSeconds: this._options.timeoutInSeconds,
95
+ maxRetries: this._options.maxRetries,
96
+ fetch: this._options.fetch,
97
+ logging: this._options.logging,
98
+ getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers,
99
+ }, requestOptions);
100
+ }
101
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
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. */
7
+ kalshi_event_ticker?: 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. */
9
+ polymarket_market_slug?: 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. */
11
+ predict_market_id?: 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. */
13
+ sxbet_market_id?: string | string[];
14
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { GetSportsMatchingMarketsRequest } from "./GetSportsMatchingMarketsRequest.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
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 BadRequestError extends errors.PredictorSDKError {
5
+ constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -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 BadRequestError extends errors.PredictorSDKError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "BadRequestError",
7
+ statusCode: 400,
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
+ }
@@ -0,0 +1,6 @@
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 ForbiddenError extends errors.PredictorSDKError {
5
+ constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -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 ForbiddenError extends errors.PredictorSDKError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "ForbiddenError",
7
+ statusCode: 403,
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
+ }
@@ -0,0 +1,6 @@
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 ServiceUnavailableError extends errors.PredictorSDKError {
5
+ constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -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 ServiceUnavailableError extends errors.PredictorSDKError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "ServiceUnavailableError",
7
+ statusCode: 503,
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
+ }
@@ -0,0 +1,6 @@
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 TooManyRequestsError extends errors.PredictorSDKError {
5
+ constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -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 TooManyRequestsError extends errors.PredictorSDKError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "TooManyRequestsError",
7
+ statusCode: 429,
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
+ }
@@ -0,0 +1,6 @@
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 UnauthorizedError extends errors.PredictorSDKError {
5
+ constructor(body: PredictorSDK.ErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -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 UnauthorizedError extends errors.PredictorSDKError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "UnauthorizedError",
7
+ statusCode: 401,
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
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./BadRequestError.js";
2
+ export * from "./ForbiddenError.js";
3
+ export * from "./ServiceUnavailableError.js";
4
+ export * from "./TooManyRequestsError.js";
5
+ export * from "./UnauthorizedError.js";
@@ -0,0 +1,5 @@
1
+ export * from "./BadRequestError.js";
2
+ export * from "./ForbiddenError.js";
3
+ export * from "./ServiceUnavailableError.js";
4
+ export * from "./TooManyRequestsError.js";
5
+ export * from "./UnauthorizedError.js";
@@ -0,0 +1,3 @@
1
+ export * from "./client/index.js";
2
+ export * from "./errors/index.js";
3
+ export * from "./types/index.js";
@@ -0,0 +1,3 @@
1
+ export * from "./client/index.js";
2
+ export * from "./errors/index.js";
3
+ export * from "./types/index.js";
@@ -0,0 +1,4 @@
1
+ export interface ErrorResponse {
2
+ error: string;
3
+ status_code: number;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,24 @@
1
+ export interface PlatformMarket {
2
+ platform: PlatformMarket.Platform;
3
+ /** Kalshi event ticker. Present when platform is KALSHI. */
4
+ event_ticker?: string | undefined;
5
+ /** Kalshi market tickers. Present when platform is KALSHI. */
6
+ market_tickers?: string[] | undefined;
7
+ /** Polymarket market slug. Present when platform is POLYMARKET. */
8
+ market_slug?: string | undefined;
9
+ /** Polymarket token IDs. Present when platform is POLYMARKET. */
10
+ token_ids?: string[] | undefined;
11
+ /** Source market ID. Present for platforms other than Kalshi and Polymarket. */
12
+ market_id?: string | undefined;
13
+ /** Source outcome IDs. Present for platforms other than Kalshi and Polymarket. */
14
+ outcome_ids?: string[] | undefined;
15
+ }
16
+ export declare namespace PlatformMarket {
17
+ const Platform: {
18
+ readonly Kalshi: "KALSHI";
19
+ readonly Polymarket: "POLYMARKET";
20
+ readonly Predict: "PREDICT";
21
+ readonly Sxbet: "SXBET";
22
+ };
23
+ type Platform = (typeof Platform)[keyof typeof Platform];
24
+ }
@@ -0,0 +1,10 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export var PlatformMarket;
3
+ (function (PlatformMarket) {
4
+ PlatformMarket.Platform = {
5
+ Kalshi: "KALSHI",
6
+ Polymarket: "POLYMARKET",
7
+ Predict: "PREDICT",
8
+ Sxbet: "SXBET",
9
+ };
10
+ })(PlatformMarket || (PlatformMarket = {}));
@@ -0,0 +1,5 @@
1
+ import type * as PredictorSDK from "../index.js";
2
+ export interface SportsMatchingResponse {
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
+ markets: Record<string, PredictorSDK.PlatformMarket[]>;
5
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from "./ErrorResponse.js";
2
+ export * from "./PlatformMarket.js";
3
+ export * from "./SportsMatchingResponse.js";
@@ -0,0 +1,3 @@
1
+ export * from "./ErrorResponse.js";
2
+ export * from "./PlatformMarket.js";
3
+ export * from "./SportsMatchingResponse.js";
@@ -0,0 +1,20 @@
1
+ import * as core from "../core/index.js";
2
+ declare const TOKEN_PARAM: "token";
3
+ export declare class BearerAuthProvider implements core.AuthProvider {
4
+ private readonly options;
5
+ constructor(options: BearerAuthProvider.Options);
6
+ static canCreate(options: Partial<BearerAuthProvider.Options>): boolean;
7
+ getAuthRequest({ endpointMetadata, }?: {
8
+ endpointMetadata?: core.EndpointMetadata;
9
+ }): Promise<core.AuthRequest>;
10
+ }
11
+ export declare namespace BearerAuthProvider {
12
+ const AUTH_SCHEME: "BearerAuth";
13
+ const AUTH_CONFIG_ERROR_MESSAGE: string;
14
+ type Options = AuthOptions;
15
+ type AuthOptions = {
16
+ [TOKEN_PARAM]: core.Supplier<core.BearerToken>;
17
+ };
18
+ function createInstance(options: Options): core.AuthProvider;
19
+ }
20
+ export {};
@@ -0,0 +1,32 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../core/index.js";
3
+ import * as errors from "../errors/index.js";
4
+ const TOKEN_PARAM = "token";
5
+ export class BearerAuthProvider {
6
+ options;
7
+ constructor(options) {
8
+ this.options = options;
9
+ }
10
+ static canCreate(options) {
11
+ return options?.[TOKEN_PARAM] != null;
12
+ }
13
+ async getAuthRequest({ endpointMetadata, } = {}) {
14
+ const token = await core.Supplier.get(this.options[TOKEN_PARAM]);
15
+ if (token == null) {
16
+ throw new errors.PredictorSDKError({
17
+ message: BearerAuthProvider.AUTH_CONFIG_ERROR_MESSAGE,
18
+ });
19
+ }
20
+ return {
21
+ headers: { Authorization: `Bearer ${token}` },
22
+ };
23
+ }
24
+ }
25
+ (function (BearerAuthProvider) {
26
+ BearerAuthProvider.AUTH_SCHEME = "BearerAuth";
27
+ BearerAuthProvider.AUTH_CONFIG_ERROR_MESSAGE = `Please provide '${TOKEN_PARAM}' when initializing the client`;
28
+ function createInstance(options) {
29
+ return new BearerAuthProvider(options);
30
+ }
31
+ BearerAuthProvider.createInstance = createInstance;
32
+ })(BearerAuthProvider || (BearerAuthProvider = {}));
@@ -0,0 +1 @@
1
+ export { BearerAuthProvider } from "./BearerAuthProvider.js";
@@ -0,0 +1 @@
1
+ export { BearerAuthProvider } from "./BearerAuthProvider.js";
@@ -0,0 +1,7 @@
1
+ import type { EndpointMetadata } from "../fetcher/EndpointMetadata.js";
2
+ import type { AuthRequest } from "./AuthRequest.js";
3
+ export interface AuthProvider {
4
+ getAuthRequest(arg?: {
5
+ endpointMetadata?: EndpointMetadata;
6
+ }): Promise<AuthRequest>;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Request parameters for authentication requests.
3
+ */
4
+ export interface AuthRequest {
5
+ /**
6
+ * The headers to be included in the request.
7
+ */
8
+ headers: Record<string, string>;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export interface BasicAuth {
2
+ username: string;
3
+ password: string;
4
+ }
5
+ export declare const BasicAuth: {
6
+ toAuthorizationHeader: (basicAuth: BasicAuth | undefined) => string | undefined;
7
+ fromAuthorizationHeader: (header: string) => BasicAuth;
8
+ };