@playcaller/sdk 0.3.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.
- package/dist/index.d.mts +289 -53
- package/dist/index.d.ts +289 -53
- package/dist/index.js +306 -0
- package/dist/index.mjs +306 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ __export(api_exports, {
|
|
|
38
38
|
ConflictError: () => ConflictError,
|
|
39
39
|
CreateWebhookRequest: () => CreateWebhookRequest,
|
|
40
40
|
EspnGame: () => EspnGame,
|
|
41
|
+
EvaluateTradeResponse: () => EvaluateTradeResponse,
|
|
41
42
|
ForbiddenError: () => ForbiddenError,
|
|
42
43
|
GetAnalyticsTrendsRequestSport: () => GetAnalyticsTrendsRequestSport,
|
|
43
44
|
GetDaaSKeyInfoResponse: () => GetDaaSKeyInfoResponse,
|
|
@@ -49,6 +50,7 @@ __export(api_exports, {
|
|
|
49
50
|
GetIntelligenceNewsRequestSeverity: () => GetIntelligenceNewsRequestSeverity,
|
|
50
51
|
GetIntelligenceNewsRequestSignalType: () => GetIntelligenceNewsRequestSignalType,
|
|
51
52
|
GetIntelligenceNewsRequestSport: () => GetIntelligenceNewsRequestSport,
|
|
53
|
+
GetLeagueHealthResponse: () => GetLeagueHealthResponse,
|
|
52
54
|
GetMlbScoringLeadersRequestPosition: () => GetMlbScoringLeadersRequestPosition,
|
|
53
55
|
GetMlbTeamRosterRequestPosition: () => GetMlbTeamRosterRequestPosition,
|
|
54
56
|
GetNbaConfidenceResponse: () => GetNbaConfidenceResponse,
|
|
@@ -99,6 +101,7 @@ __export(api_exports, {
|
|
|
99
101
|
cfb: () => cfb_exports,
|
|
100
102
|
golf: () => golf_exports,
|
|
101
103
|
intelligence: () => intelligence_exports,
|
|
104
|
+
leagues: () => leagues_exports,
|
|
102
105
|
mcp: () => mcp_exports,
|
|
103
106
|
mlb: () => mlb_exports,
|
|
104
107
|
multi: () => multi_exports,
|
|
@@ -420,6 +423,38 @@ var GetIntelligenceNewsRequestSport = {
|
|
|
420
423
|
All: "all"
|
|
421
424
|
};
|
|
422
425
|
|
|
426
|
+
// api/resources/leagues/index.ts
|
|
427
|
+
var leagues_exports = {};
|
|
428
|
+
__export(leagues_exports, {
|
|
429
|
+
EvaluateTradeResponse: () => EvaluateTradeResponse,
|
|
430
|
+
GetLeagueHealthResponse: () => GetLeagueHealthResponse
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// api/resources/leagues/types/EvaluateTradeResponse.ts
|
|
434
|
+
var EvaluateTradeResponse;
|
|
435
|
+
((EvaluateTradeResponse2) => {
|
|
436
|
+
EvaluateTradeResponse2.Verdict = {
|
|
437
|
+
Win: "win",
|
|
438
|
+
Loss: "loss",
|
|
439
|
+
Fair: "fair"
|
|
440
|
+
};
|
|
441
|
+
EvaluateTradeResponse2.Confidence = {
|
|
442
|
+
High: "high",
|
|
443
|
+
Medium: "medium",
|
|
444
|
+
Low: "low"
|
|
445
|
+
};
|
|
446
|
+
})(EvaluateTradeResponse || (EvaluateTradeResponse = {}));
|
|
447
|
+
|
|
448
|
+
// api/resources/leagues/types/GetLeagueHealthResponse.ts
|
|
449
|
+
var GetLeagueHealthResponse;
|
|
450
|
+
((GetLeagueHealthResponse2) => {
|
|
451
|
+
GetLeagueHealthResponse2.ParityLabel = {
|
|
452
|
+
Competitive: "Competitive",
|
|
453
|
+
Balanced: "Balanced",
|
|
454
|
+
Lopsided: "Lopsided"
|
|
455
|
+
};
|
|
456
|
+
})(GetLeagueHealthResponse || (GetLeagueHealthResponse = {}));
|
|
457
|
+
|
|
423
458
|
// api/resources/mcp/client/requests/InvokeMcpToolRequest.ts
|
|
424
459
|
var InvokeMcpToolRequest;
|
|
425
460
|
((InvokeMcpToolRequest2) => {
|
|
@@ -4217,6 +4252,274 @@ var IntelligenceClient = class {
|
|
|
4217
4252
|
}
|
|
4218
4253
|
};
|
|
4219
4254
|
|
|
4255
|
+
// api/resources/leagues/client/Client.ts
|
|
4256
|
+
var LeaguesClient = class {
|
|
4257
|
+
constructor(options = {}) {
|
|
4258
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
4259
|
+
}
|
|
4260
|
+
/**
|
|
4261
|
+
* Returns standings, parity index, and Pythagorean playoff probabilities for all teams in a native PlayCaller league. The API key's email must match an active league member.
|
|
4262
|
+
*
|
|
4263
|
+
* **Tier access:** Developer Sandbox, Build, Growth, Pro Insights, Syndicate Alpha
|
|
4264
|
+
*
|
|
4265
|
+
* @param {PlaycallerApi.GetLeagueHealthRequest} request
|
|
4266
|
+
* @param {LeaguesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
4267
|
+
*
|
|
4268
|
+
* @throws {@link PlaycallerApi.UnauthorizedError}
|
|
4269
|
+
* @throws {@link PlaycallerApi.ForbiddenError}
|
|
4270
|
+
* @throws {@link PlaycallerApi.TooManyRequestsError}
|
|
4271
|
+
* @throws {@link PlaycallerApi.InternalServerError}
|
|
4272
|
+
*
|
|
4273
|
+
* @example
|
|
4274
|
+
* await client.leagues.getLeagueHealth({
|
|
4275
|
+
* leagueId: 1
|
|
4276
|
+
* })
|
|
4277
|
+
*/
|
|
4278
|
+
getLeagueHealth(request, requestOptions) {
|
|
4279
|
+
return HttpResponsePromise.fromPromise(this.__getLeagueHealth(request, requestOptions));
|
|
4280
|
+
}
|
|
4281
|
+
async __getLeagueHealth(request, requestOptions) {
|
|
4282
|
+
const { leagueId } = request;
|
|
4283
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
4284
|
+
const _headers = mergeHeaders(
|
|
4285
|
+
_authRequest.headers,
|
|
4286
|
+
this._options?.headers,
|
|
4287
|
+
requestOptions?.headers
|
|
4288
|
+
);
|
|
4289
|
+
const _response = await fetcher({
|
|
4290
|
+
url: url_exports.join(
|
|
4291
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? PlaycallerApiEnvironment.Production,
|
|
4292
|
+
`v1/leagues/${url_exports.encodePathParam(leagueId)}/health`
|
|
4293
|
+
),
|
|
4294
|
+
method: "GET",
|
|
4295
|
+
headers: _headers,
|
|
4296
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
4297
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
4298
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
4299
|
+
abortSignal: requestOptions?.abortSignal,
|
|
4300
|
+
fetchFn: this._options?.fetch,
|
|
4301
|
+
logging: this._options.logging
|
|
4302
|
+
});
|
|
4303
|
+
if (_response.ok) {
|
|
4304
|
+
return {
|
|
4305
|
+
data: _response.body,
|
|
4306
|
+
rawResponse: _response.rawResponse
|
|
4307
|
+
};
|
|
4308
|
+
}
|
|
4309
|
+
if (_response.error.reason === "status-code") {
|
|
4310
|
+
switch (_response.error.statusCode) {
|
|
4311
|
+
case 401:
|
|
4312
|
+
throw new UnauthorizedError(
|
|
4313
|
+
_response.error.body,
|
|
4314
|
+
_response.rawResponse
|
|
4315
|
+
);
|
|
4316
|
+
case 403:
|
|
4317
|
+
throw new ForbiddenError(
|
|
4318
|
+
_response.error.body,
|
|
4319
|
+
_response.rawResponse
|
|
4320
|
+
);
|
|
4321
|
+
case 429:
|
|
4322
|
+
throw new TooManyRequestsError(
|
|
4323
|
+
_response.error.body,
|
|
4324
|
+
_response.rawResponse
|
|
4325
|
+
);
|
|
4326
|
+
case 500:
|
|
4327
|
+
throw new InternalServerError(
|
|
4328
|
+
_response.error.body,
|
|
4329
|
+
_response.rawResponse
|
|
4330
|
+
);
|
|
4331
|
+
default:
|
|
4332
|
+
throw new PlaycallerApiError({
|
|
4333
|
+
statusCode: _response.error.statusCode,
|
|
4334
|
+
body: _response.error.body,
|
|
4335
|
+
rawResponse: _response.rawResponse
|
|
4336
|
+
});
|
|
4337
|
+
}
|
|
4338
|
+
}
|
|
4339
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/leagues/{leagueId}/health");
|
|
4340
|
+
}
|
|
4341
|
+
/**
|
|
4342
|
+
* Uses Claude Haiku to recommend optimal starters from your current roster, considering matchups, recent form, and injury status. Cached for 1 hour. The API key's email must match an active league member.
|
|
4343
|
+
*
|
|
4344
|
+
* **Tier access:** Developer Sandbox, Build, Growth, Pro Insights, Syndicate Alpha
|
|
4345
|
+
*
|
|
4346
|
+
* @param {PlaycallerApi.GetLeagueStartSitRequest} request
|
|
4347
|
+
* @param {LeaguesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
4348
|
+
*
|
|
4349
|
+
* @throws {@link PlaycallerApi.UnauthorizedError}
|
|
4350
|
+
* @throws {@link PlaycallerApi.ForbiddenError}
|
|
4351
|
+
* @throws {@link PlaycallerApi.NotFoundError}
|
|
4352
|
+
* @throws {@link PlaycallerApi.TooManyRequestsError}
|
|
4353
|
+
* @throws {@link PlaycallerApi.InternalServerError}
|
|
4354
|
+
*
|
|
4355
|
+
* @example
|
|
4356
|
+
* await client.leagues.getLeagueStartSit({
|
|
4357
|
+
* leagueId: 1
|
|
4358
|
+
* })
|
|
4359
|
+
*/
|
|
4360
|
+
getLeagueStartSit(request, requestOptions) {
|
|
4361
|
+
return HttpResponsePromise.fromPromise(this.__getLeagueStartSit(request, requestOptions));
|
|
4362
|
+
}
|
|
4363
|
+
async __getLeagueStartSit(request, requestOptions) {
|
|
4364
|
+
const { leagueId } = request;
|
|
4365
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
4366
|
+
const _headers = mergeHeaders(
|
|
4367
|
+
_authRequest.headers,
|
|
4368
|
+
this._options?.headers,
|
|
4369
|
+
requestOptions?.headers
|
|
4370
|
+
);
|
|
4371
|
+
const _response = await fetcher({
|
|
4372
|
+
url: url_exports.join(
|
|
4373
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? PlaycallerApiEnvironment.Production,
|
|
4374
|
+
`v1/leagues/${url_exports.encodePathParam(leagueId)}/start-sit`
|
|
4375
|
+
),
|
|
4376
|
+
method: "GET",
|
|
4377
|
+
headers: _headers,
|
|
4378
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
4379
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
4380
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
4381
|
+
abortSignal: requestOptions?.abortSignal,
|
|
4382
|
+
fetchFn: this._options?.fetch,
|
|
4383
|
+
logging: this._options.logging
|
|
4384
|
+
});
|
|
4385
|
+
if (_response.ok) {
|
|
4386
|
+
return {
|
|
4387
|
+
data: _response.body,
|
|
4388
|
+
rawResponse: _response.rawResponse
|
|
4389
|
+
};
|
|
4390
|
+
}
|
|
4391
|
+
if (_response.error.reason === "status-code") {
|
|
4392
|
+
switch (_response.error.statusCode) {
|
|
4393
|
+
case 401:
|
|
4394
|
+
throw new UnauthorizedError(
|
|
4395
|
+
_response.error.body,
|
|
4396
|
+
_response.rawResponse
|
|
4397
|
+
);
|
|
4398
|
+
case 403:
|
|
4399
|
+
throw new ForbiddenError(
|
|
4400
|
+
_response.error.body,
|
|
4401
|
+
_response.rawResponse
|
|
4402
|
+
);
|
|
4403
|
+
case 404:
|
|
4404
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
4405
|
+
case 429:
|
|
4406
|
+
throw new TooManyRequestsError(
|
|
4407
|
+
_response.error.body,
|
|
4408
|
+
_response.rawResponse
|
|
4409
|
+
);
|
|
4410
|
+
case 500:
|
|
4411
|
+
throw new InternalServerError(
|
|
4412
|
+
_response.error.body,
|
|
4413
|
+
_response.rawResponse
|
|
4414
|
+
);
|
|
4415
|
+
default:
|
|
4416
|
+
throw new PlaycallerApiError({
|
|
4417
|
+
statusCode: _response.error.statusCode,
|
|
4418
|
+
body: _response.error.body,
|
|
4419
|
+
rawResponse: _response.rawResponse
|
|
4420
|
+
});
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
return handleNonStatusCodeError(
|
|
4424
|
+
_response.error,
|
|
4425
|
+
_response.rawResponse,
|
|
4426
|
+
"GET",
|
|
4427
|
+
"/v1/leagues/{leagueId}/start-sit"
|
|
4428
|
+
);
|
|
4429
|
+
}
|
|
4430
|
+
/**
|
|
4431
|
+
* Submits a proposed trade for AI analysis. Returns a win/loss/fair verdict with per-player assessments, KTC dynasty values (NFL/NBA/MLB), confidence scores, and recent PPG context. The API key's email must match an active league member.
|
|
4432
|
+
*
|
|
4433
|
+
* **Tier access:** Pro Insights, Syndicate Alpha
|
|
4434
|
+
*
|
|
4435
|
+
* @param {PlaycallerApi.EvaluateTradeRequest} request
|
|
4436
|
+
* @param {LeaguesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
4437
|
+
*
|
|
4438
|
+
* @throws {@link PlaycallerApi.BadRequestError}
|
|
4439
|
+
* @throws {@link PlaycallerApi.UnauthorizedError}
|
|
4440
|
+
* @throws {@link PlaycallerApi.ForbiddenError}
|
|
4441
|
+
* @throws {@link PlaycallerApi.TooManyRequestsError}
|
|
4442
|
+
* @throws {@link PlaycallerApi.InternalServerError}
|
|
4443
|
+
*
|
|
4444
|
+
* @example
|
|
4445
|
+
* await client.leagues.evaluateTrade({
|
|
4446
|
+
* leagueId: 1,
|
|
4447
|
+
* give: ["pc_nfl_2374"],
|
|
4448
|
+
* get: ["pc_nfl_4046"]
|
|
4449
|
+
* })
|
|
4450
|
+
*/
|
|
4451
|
+
evaluateTrade(request, requestOptions) {
|
|
4452
|
+
return HttpResponsePromise.fromPromise(this.__evaluateTrade(request, requestOptions));
|
|
4453
|
+
}
|
|
4454
|
+
async __evaluateTrade(request, requestOptions) {
|
|
4455
|
+
const { leagueId, ..._body } = request;
|
|
4456
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
4457
|
+
const _headers = mergeHeaders(
|
|
4458
|
+
_authRequest.headers,
|
|
4459
|
+
this._options?.headers,
|
|
4460
|
+
requestOptions?.headers
|
|
4461
|
+
);
|
|
4462
|
+
const _response = await fetcher({
|
|
4463
|
+
url: url_exports.join(
|
|
4464
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? PlaycallerApiEnvironment.Production,
|
|
4465
|
+
`v1/leagues/${url_exports.encodePathParam(leagueId)}/trade/evaluate`
|
|
4466
|
+
),
|
|
4467
|
+
method: "POST",
|
|
4468
|
+
headers: _headers,
|
|
4469
|
+
contentType: "application/json",
|
|
4470
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
4471
|
+
requestType: "json",
|
|
4472
|
+
body: _body,
|
|
4473
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
4474
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
4475
|
+
abortSignal: requestOptions?.abortSignal,
|
|
4476
|
+
fetchFn: this._options?.fetch,
|
|
4477
|
+
logging: this._options.logging
|
|
4478
|
+
});
|
|
4479
|
+
if (_response.ok) {
|
|
4480
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
4481
|
+
}
|
|
4482
|
+
if (_response.error.reason === "status-code") {
|
|
4483
|
+
switch (_response.error.statusCode) {
|
|
4484
|
+
case 400:
|
|
4485
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
4486
|
+
case 401:
|
|
4487
|
+
throw new UnauthorizedError(
|
|
4488
|
+
_response.error.body,
|
|
4489
|
+
_response.rawResponse
|
|
4490
|
+
);
|
|
4491
|
+
case 403:
|
|
4492
|
+
throw new ForbiddenError(
|
|
4493
|
+
_response.error.body,
|
|
4494
|
+
_response.rawResponse
|
|
4495
|
+
);
|
|
4496
|
+
case 429:
|
|
4497
|
+
throw new TooManyRequestsError(
|
|
4498
|
+
_response.error.body,
|
|
4499
|
+
_response.rawResponse
|
|
4500
|
+
);
|
|
4501
|
+
case 500:
|
|
4502
|
+
throw new InternalServerError(
|
|
4503
|
+
_response.error.body,
|
|
4504
|
+
_response.rawResponse
|
|
4505
|
+
);
|
|
4506
|
+
default:
|
|
4507
|
+
throw new PlaycallerApiError({
|
|
4508
|
+
statusCode: _response.error.statusCode,
|
|
4509
|
+
body: _response.error.body,
|
|
4510
|
+
rawResponse: _response.rawResponse
|
|
4511
|
+
});
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
return handleNonStatusCodeError(
|
|
4515
|
+
_response.error,
|
|
4516
|
+
_response.rawResponse,
|
|
4517
|
+
"POST",
|
|
4518
|
+
"/v1/leagues/{leagueId}/trade/evaluate"
|
|
4519
|
+
);
|
|
4520
|
+
}
|
|
4521
|
+
};
|
|
4522
|
+
|
|
4220
4523
|
// api/resources/mcp/client/Client.ts
|
|
4221
4524
|
var McpClient = class {
|
|
4222
4525
|
constructor(options = {}) {
|
|
@@ -8887,6 +9190,9 @@ var PlaycallerApiClient = class {
|
|
|
8887
9190
|
get multi() {
|
|
8888
9191
|
return this._multi ?? (this._multi = new MultiClient(this._options));
|
|
8889
9192
|
}
|
|
9193
|
+
get leagues() {
|
|
9194
|
+
return this._leagues ?? (this._leagues = new LeaguesClient(this._options));
|
|
9195
|
+
}
|
|
8890
9196
|
get account() {
|
|
8891
9197
|
return this._account ?? (this._account = new AccountClient(this._options));
|
|
8892
9198
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -13,6 +13,7 @@ __export(api_exports, {
|
|
|
13
13
|
ConflictError: () => ConflictError,
|
|
14
14
|
CreateWebhookRequest: () => CreateWebhookRequest,
|
|
15
15
|
EspnGame: () => EspnGame,
|
|
16
|
+
EvaluateTradeResponse: () => EvaluateTradeResponse,
|
|
16
17
|
ForbiddenError: () => ForbiddenError,
|
|
17
18
|
GetAnalyticsTrendsRequestSport: () => GetAnalyticsTrendsRequestSport,
|
|
18
19
|
GetDaaSKeyInfoResponse: () => GetDaaSKeyInfoResponse,
|
|
@@ -24,6 +25,7 @@ __export(api_exports, {
|
|
|
24
25
|
GetIntelligenceNewsRequestSeverity: () => GetIntelligenceNewsRequestSeverity,
|
|
25
26
|
GetIntelligenceNewsRequestSignalType: () => GetIntelligenceNewsRequestSignalType,
|
|
26
27
|
GetIntelligenceNewsRequestSport: () => GetIntelligenceNewsRequestSport,
|
|
28
|
+
GetLeagueHealthResponse: () => GetLeagueHealthResponse,
|
|
27
29
|
GetMlbScoringLeadersRequestPosition: () => GetMlbScoringLeadersRequestPosition,
|
|
28
30
|
GetMlbTeamRosterRequestPosition: () => GetMlbTeamRosterRequestPosition,
|
|
29
31
|
GetNbaConfidenceResponse: () => GetNbaConfidenceResponse,
|
|
@@ -74,6 +76,7 @@ __export(api_exports, {
|
|
|
74
76
|
cfb: () => cfb_exports,
|
|
75
77
|
golf: () => golf_exports,
|
|
76
78
|
intelligence: () => intelligence_exports,
|
|
79
|
+
leagues: () => leagues_exports,
|
|
77
80
|
mcp: () => mcp_exports,
|
|
78
81
|
mlb: () => mlb_exports,
|
|
79
82
|
multi: () => multi_exports,
|
|
@@ -395,6 +398,38 @@ var GetIntelligenceNewsRequestSport = {
|
|
|
395
398
|
All: "all"
|
|
396
399
|
};
|
|
397
400
|
|
|
401
|
+
// api/resources/leagues/index.ts
|
|
402
|
+
var leagues_exports = {};
|
|
403
|
+
__export(leagues_exports, {
|
|
404
|
+
EvaluateTradeResponse: () => EvaluateTradeResponse,
|
|
405
|
+
GetLeagueHealthResponse: () => GetLeagueHealthResponse
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
// api/resources/leagues/types/EvaluateTradeResponse.ts
|
|
409
|
+
var EvaluateTradeResponse;
|
|
410
|
+
((EvaluateTradeResponse2) => {
|
|
411
|
+
EvaluateTradeResponse2.Verdict = {
|
|
412
|
+
Win: "win",
|
|
413
|
+
Loss: "loss",
|
|
414
|
+
Fair: "fair"
|
|
415
|
+
};
|
|
416
|
+
EvaluateTradeResponse2.Confidence = {
|
|
417
|
+
High: "high",
|
|
418
|
+
Medium: "medium",
|
|
419
|
+
Low: "low"
|
|
420
|
+
};
|
|
421
|
+
})(EvaluateTradeResponse || (EvaluateTradeResponse = {}));
|
|
422
|
+
|
|
423
|
+
// api/resources/leagues/types/GetLeagueHealthResponse.ts
|
|
424
|
+
var GetLeagueHealthResponse;
|
|
425
|
+
((GetLeagueHealthResponse2) => {
|
|
426
|
+
GetLeagueHealthResponse2.ParityLabel = {
|
|
427
|
+
Competitive: "Competitive",
|
|
428
|
+
Balanced: "Balanced",
|
|
429
|
+
Lopsided: "Lopsided"
|
|
430
|
+
};
|
|
431
|
+
})(GetLeagueHealthResponse || (GetLeagueHealthResponse = {}));
|
|
432
|
+
|
|
398
433
|
// api/resources/mcp/client/requests/InvokeMcpToolRequest.ts
|
|
399
434
|
var InvokeMcpToolRequest;
|
|
400
435
|
((InvokeMcpToolRequest2) => {
|
|
@@ -4192,6 +4227,274 @@ var IntelligenceClient = class {
|
|
|
4192
4227
|
}
|
|
4193
4228
|
};
|
|
4194
4229
|
|
|
4230
|
+
// api/resources/leagues/client/Client.ts
|
|
4231
|
+
var LeaguesClient = class {
|
|
4232
|
+
constructor(options = {}) {
|
|
4233
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
4234
|
+
}
|
|
4235
|
+
/**
|
|
4236
|
+
* Returns standings, parity index, and Pythagorean playoff probabilities for all teams in a native PlayCaller league. The API key's email must match an active league member.
|
|
4237
|
+
*
|
|
4238
|
+
* **Tier access:** Developer Sandbox, Build, Growth, Pro Insights, Syndicate Alpha
|
|
4239
|
+
*
|
|
4240
|
+
* @param {PlaycallerApi.GetLeagueHealthRequest} request
|
|
4241
|
+
* @param {LeaguesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
4242
|
+
*
|
|
4243
|
+
* @throws {@link PlaycallerApi.UnauthorizedError}
|
|
4244
|
+
* @throws {@link PlaycallerApi.ForbiddenError}
|
|
4245
|
+
* @throws {@link PlaycallerApi.TooManyRequestsError}
|
|
4246
|
+
* @throws {@link PlaycallerApi.InternalServerError}
|
|
4247
|
+
*
|
|
4248
|
+
* @example
|
|
4249
|
+
* await client.leagues.getLeagueHealth({
|
|
4250
|
+
* leagueId: 1
|
|
4251
|
+
* })
|
|
4252
|
+
*/
|
|
4253
|
+
getLeagueHealth(request, requestOptions) {
|
|
4254
|
+
return HttpResponsePromise.fromPromise(this.__getLeagueHealth(request, requestOptions));
|
|
4255
|
+
}
|
|
4256
|
+
async __getLeagueHealth(request, requestOptions) {
|
|
4257
|
+
const { leagueId } = request;
|
|
4258
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
4259
|
+
const _headers = mergeHeaders(
|
|
4260
|
+
_authRequest.headers,
|
|
4261
|
+
this._options?.headers,
|
|
4262
|
+
requestOptions?.headers
|
|
4263
|
+
);
|
|
4264
|
+
const _response = await fetcher({
|
|
4265
|
+
url: url_exports.join(
|
|
4266
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? PlaycallerApiEnvironment.Production,
|
|
4267
|
+
`v1/leagues/${url_exports.encodePathParam(leagueId)}/health`
|
|
4268
|
+
),
|
|
4269
|
+
method: "GET",
|
|
4270
|
+
headers: _headers,
|
|
4271
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
4272
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
4273
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
4274
|
+
abortSignal: requestOptions?.abortSignal,
|
|
4275
|
+
fetchFn: this._options?.fetch,
|
|
4276
|
+
logging: this._options.logging
|
|
4277
|
+
});
|
|
4278
|
+
if (_response.ok) {
|
|
4279
|
+
return {
|
|
4280
|
+
data: _response.body,
|
|
4281
|
+
rawResponse: _response.rawResponse
|
|
4282
|
+
};
|
|
4283
|
+
}
|
|
4284
|
+
if (_response.error.reason === "status-code") {
|
|
4285
|
+
switch (_response.error.statusCode) {
|
|
4286
|
+
case 401:
|
|
4287
|
+
throw new UnauthorizedError(
|
|
4288
|
+
_response.error.body,
|
|
4289
|
+
_response.rawResponse
|
|
4290
|
+
);
|
|
4291
|
+
case 403:
|
|
4292
|
+
throw new ForbiddenError(
|
|
4293
|
+
_response.error.body,
|
|
4294
|
+
_response.rawResponse
|
|
4295
|
+
);
|
|
4296
|
+
case 429:
|
|
4297
|
+
throw new TooManyRequestsError(
|
|
4298
|
+
_response.error.body,
|
|
4299
|
+
_response.rawResponse
|
|
4300
|
+
);
|
|
4301
|
+
case 500:
|
|
4302
|
+
throw new InternalServerError(
|
|
4303
|
+
_response.error.body,
|
|
4304
|
+
_response.rawResponse
|
|
4305
|
+
);
|
|
4306
|
+
default:
|
|
4307
|
+
throw new PlaycallerApiError({
|
|
4308
|
+
statusCode: _response.error.statusCode,
|
|
4309
|
+
body: _response.error.body,
|
|
4310
|
+
rawResponse: _response.rawResponse
|
|
4311
|
+
});
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/leagues/{leagueId}/health");
|
|
4315
|
+
}
|
|
4316
|
+
/**
|
|
4317
|
+
* Uses Claude Haiku to recommend optimal starters from your current roster, considering matchups, recent form, and injury status. Cached for 1 hour. The API key's email must match an active league member.
|
|
4318
|
+
*
|
|
4319
|
+
* **Tier access:** Developer Sandbox, Build, Growth, Pro Insights, Syndicate Alpha
|
|
4320
|
+
*
|
|
4321
|
+
* @param {PlaycallerApi.GetLeagueStartSitRequest} request
|
|
4322
|
+
* @param {LeaguesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
4323
|
+
*
|
|
4324
|
+
* @throws {@link PlaycallerApi.UnauthorizedError}
|
|
4325
|
+
* @throws {@link PlaycallerApi.ForbiddenError}
|
|
4326
|
+
* @throws {@link PlaycallerApi.NotFoundError}
|
|
4327
|
+
* @throws {@link PlaycallerApi.TooManyRequestsError}
|
|
4328
|
+
* @throws {@link PlaycallerApi.InternalServerError}
|
|
4329
|
+
*
|
|
4330
|
+
* @example
|
|
4331
|
+
* await client.leagues.getLeagueStartSit({
|
|
4332
|
+
* leagueId: 1
|
|
4333
|
+
* })
|
|
4334
|
+
*/
|
|
4335
|
+
getLeagueStartSit(request, requestOptions) {
|
|
4336
|
+
return HttpResponsePromise.fromPromise(this.__getLeagueStartSit(request, requestOptions));
|
|
4337
|
+
}
|
|
4338
|
+
async __getLeagueStartSit(request, requestOptions) {
|
|
4339
|
+
const { leagueId } = request;
|
|
4340
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
4341
|
+
const _headers = mergeHeaders(
|
|
4342
|
+
_authRequest.headers,
|
|
4343
|
+
this._options?.headers,
|
|
4344
|
+
requestOptions?.headers
|
|
4345
|
+
);
|
|
4346
|
+
const _response = await fetcher({
|
|
4347
|
+
url: url_exports.join(
|
|
4348
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? PlaycallerApiEnvironment.Production,
|
|
4349
|
+
`v1/leagues/${url_exports.encodePathParam(leagueId)}/start-sit`
|
|
4350
|
+
),
|
|
4351
|
+
method: "GET",
|
|
4352
|
+
headers: _headers,
|
|
4353
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
4354
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
4355
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
4356
|
+
abortSignal: requestOptions?.abortSignal,
|
|
4357
|
+
fetchFn: this._options?.fetch,
|
|
4358
|
+
logging: this._options.logging
|
|
4359
|
+
});
|
|
4360
|
+
if (_response.ok) {
|
|
4361
|
+
return {
|
|
4362
|
+
data: _response.body,
|
|
4363
|
+
rawResponse: _response.rawResponse
|
|
4364
|
+
};
|
|
4365
|
+
}
|
|
4366
|
+
if (_response.error.reason === "status-code") {
|
|
4367
|
+
switch (_response.error.statusCode) {
|
|
4368
|
+
case 401:
|
|
4369
|
+
throw new UnauthorizedError(
|
|
4370
|
+
_response.error.body,
|
|
4371
|
+
_response.rawResponse
|
|
4372
|
+
);
|
|
4373
|
+
case 403:
|
|
4374
|
+
throw new ForbiddenError(
|
|
4375
|
+
_response.error.body,
|
|
4376
|
+
_response.rawResponse
|
|
4377
|
+
);
|
|
4378
|
+
case 404:
|
|
4379
|
+
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
4380
|
+
case 429:
|
|
4381
|
+
throw new TooManyRequestsError(
|
|
4382
|
+
_response.error.body,
|
|
4383
|
+
_response.rawResponse
|
|
4384
|
+
);
|
|
4385
|
+
case 500:
|
|
4386
|
+
throw new InternalServerError(
|
|
4387
|
+
_response.error.body,
|
|
4388
|
+
_response.rawResponse
|
|
4389
|
+
);
|
|
4390
|
+
default:
|
|
4391
|
+
throw new PlaycallerApiError({
|
|
4392
|
+
statusCode: _response.error.statusCode,
|
|
4393
|
+
body: _response.error.body,
|
|
4394
|
+
rawResponse: _response.rawResponse
|
|
4395
|
+
});
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
return handleNonStatusCodeError(
|
|
4399
|
+
_response.error,
|
|
4400
|
+
_response.rawResponse,
|
|
4401
|
+
"GET",
|
|
4402
|
+
"/v1/leagues/{leagueId}/start-sit"
|
|
4403
|
+
);
|
|
4404
|
+
}
|
|
4405
|
+
/**
|
|
4406
|
+
* Submits a proposed trade for AI analysis. Returns a win/loss/fair verdict with per-player assessments, KTC dynasty values (NFL/NBA/MLB), confidence scores, and recent PPG context. The API key's email must match an active league member.
|
|
4407
|
+
*
|
|
4408
|
+
* **Tier access:** Pro Insights, Syndicate Alpha
|
|
4409
|
+
*
|
|
4410
|
+
* @param {PlaycallerApi.EvaluateTradeRequest} request
|
|
4411
|
+
* @param {LeaguesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
4412
|
+
*
|
|
4413
|
+
* @throws {@link PlaycallerApi.BadRequestError}
|
|
4414
|
+
* @throws {@link PlaycallerApi.UnauthorizedError}
|
|
4415
|
+
* @throws {@link PlaycallerApi.ForbiddenError}
|
|
4416
|
+
* @throws {@link PlaycallerApi.TooManyRequestsError}
|
|
4417
|
+
* @throws {@link PlaycallerApi.InternalServerError}
|
|
4418
|
+
*
|
|
4419
|
+
* @example
|
|
4420
|
+
* await client.leagues.evaluateTrade({
|
|
4421
|
+
* leagueId: 1,
|
|
4422
|
+
* give: ["pc_nfl_2374"],
|
|
4423
|
+
* get: ["pc_nfl_4046"]
|
|
4424
|
+
* })
|
|
4425
|
+
*/
|
|
4426
|
+
evaluateTrade(request, requestOptions) {
|
|
4427
|
+
return HttpResponsePromise.fromPromise(this.__evaluateTrade(request, requestOptions));
|
|
4428
|
+
}
|
|
4429
|
+
async __evaluateTrade(request, requestOptions) {
|
|
4430
|
+
const { leagueId, ..._body } = request;
|
|
4431
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
4432
|
+
const _headers = mergeHeaders(
|
|
4433
|
+
_authRequest.headers,
|
|
4434
|
+
this._options?.headers,
|
|
4435
|
+
requestOptions?.headers
|
|
4436
|
+
);
|
|
4437
|
+
const _response = await fetcher({
|
|
4438
|
+
url: url_exports.join(
|
|
4439
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? PlaycallerApiEnvironment.Production,
|
|
4440
|
+
`v1/leagues/${url_exports.encodePathParam(leagueId)}/trade/evaluate`
|
|
4441
|
+
),
|
|
4442
|
+
method: "POST",
|
|
4443
|
+
headers: _headers,
|
|
4444
|
+
contentType: "application/json",
|
|
4445
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
4446
|
+
requestType: "json",
|
|
4447
|
+
body: _body,
|
|
4448
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
4449
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
4450
|
+
abortSignal: requestOptions?.abortSignal,
|
|
4451
|
+
fetchFn: this._options?.fetch,
|
|
4452
|
+
logging: this._options.logging
|
|
4453
|
+
});
|
|
4454
|
+
if (_response.ok) {
|
|
4455
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
4456
|
+
}
|
|
4457
|
+
if (_response.error.reason === "status-code") {
|
|
4458
|
+
switch (_response.error.statusCode) {
|
|
4459
|
+
case 400:
|
|
4460
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
4461
|
+
case 401:
|
|
4462
|
+
throw new UnauthorizedError(
|
|
4463
|
+
_response.error.body,
|
|
4464
|
+
_response.rawResponse
|
|
4465
|
+
);
|
|
4466
|
+
case 403:
|
|
4467
|
+
throw new ForbiddenError(
|
|
4468
|
+
_response.error.body,
|
|
4469
|
+
_response.rawResponse
|
|
4470
|
+
);
|
|
4471
|
+
case 429:
|
|
4472
|
+
throw new TooManyRequestsError(
|
|
4473
|
+
_response.error.body,
|
|
4474
|
+
_response.rawResponse
|
|
4475
|
+
);
|
|
4476
|
+
case 500:
|
|
4477
|
+
throw new InternalServerError(
|
|
4478
|
+
_response.error.body,
|
|
4479
|
+
_response.rawResponse
|
|
4480
|
+
);
|
|
4481
|
+
default:
|
|
4482
|
+
throw new PlaycallerApiError({
|
|
4483
|
+
statusCode: _response.error.statusCode,
|
|
4484
|
+
body: _response.error.body,
|
|
4485
|
+
rawResponse: _response.rawResponse
|
|
4486
|
+
});
|
|
4487
|
+
}
|
|
4488
|
+
}
|
|
4489
|
+
return handleNonStatusCodeError(
|
|
4490
|
+
_response.error,
|
|
4491
|
+
_response.rawResponse,
|
|
4492
|
+
"POST",
|
|
4493
|
+
"/v1/leagues/{leagueId}/trade/evaluate"
|
|
4494
|
+
);
|
|
4495
|
+
}
|
|
4496
|
+
};
|
|
4497
|
+
|
|
4195
4498
|
// api/resources/mcp/client/Client.ts
|
|
4196
4499
|
var McpClient = class {
|
|
4197
4500
|
constructor(options = {}) {
|
|
@@ -8862,6 +9165,9 @@ var PlaycallerApiClient = class {
|
|
|
8862
9165
|
get multi() {
|
|
8863
9166
|
return this._multi ?? (this._multi = new MultiClient(this._options));
|
|
8864
9167
|
}
|
|
9168
|
+
get leagues() {
|
|
9169
|
+
return this._leagues ?? (this._leagues = new LeaguesClient(this._options));
|
|
9170
|
+
}
|
|
8865
9171
|
get account() {
|
|
8866
9172
|
return this._account ?? (this._account = new AccountClient(this._options));
|
|
8867
9173
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcaller/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Official TypeScript SDK for PlayCaller — real-time sports data, AI-powered analytics, and ML signals for fantasy football, baseball, basketball, hockey, golf, soccer, tennis, and UFC",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|