Skip to content

Commit 55a33fa

Browse files
authored
Merging pull request #17976
* new source * pnpm-lock.yaml * pnpm-lock.yaml
1 parent 1760de2 commit 55a33fa

File tree

5 files changed

+70
-9
lines changed

5 files changed

+70
-9
lines changed

components/yahoo_fantasy_sports/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/yahoo_fantasy_sports",
3-
"version": "0.3.7",
3+
"version": "0.4.0",
44
"description": "Pipedream Yahoo_fantasy_sports Components",
55
"main": "yahoo_fantasy_sports.app.mjs",
66
"keywords": [
@@ -14,6 +14,6 @@
1414
"access": "public"
1515
},
1616
"dependencies": {
17-
"@pipedream/platform": "^1.2.0"
17+
"@pipedream/platform": "^3.1.0"
1818
}
1919
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import yfs from "../../yahoo_fantasy_sports.app.mjs";
2+
import options from "../common/options.mjs";
3+
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
4+
5+
export default {
6+
key: "yahoo_fantasy_sports-new-baseball-league-transactions",
7+
name: "New Baseball League Transactions",
8+
description: "Emit new event when a new baseball league transaction occurs",
9+
version: "0.0.1",
10+
type: "source",
11+
dedupe: "unique",
12+
props: {
13+
yfs,
14+
league: {
15+
propDefinition: [
16+
yfs,
17+
"league",
18+
() => ({
19+
gameKey: "mlb",
20+
}),
21+
],
22+
},
23+
eventTypes: {
24+
type: "string[]",
25+
label: "Event Types",
26+
description: "Select the types of events to watch for",
27+
options: options.EVENT_TYPES,
28+
optional: true,
29+
default: [
30+
"*",
31+
],
32+
},
33+
timer: {
34+
label: "Polling interval",
35+
description: "Pipedream will poll the API on this schedule",
36+
type: "$.interface.timer",
37+
default: {
38+
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
39+
},
40+
},
41+
},
42+
async run() {
43+
const eventTypes = this.eventTypes.includes("*")
44+
? options.ALL_EVENT_TYPES
45+
: this.eventTypes;
46+
47+
const transactions = await this.yfs.getLeagueTransactions(this.league, eventTypes);
48+
if (Object.keys(transactions).length === 0) {
49+
return;
50+
}
51+
52+
for (const txn of transactions) {
53+
txn._summary = this.yfs.transactionSummary(txn);
54+
this.$emit(txn, {
55+
id: txn.transaction_key,
56+
ts: (+txn.timestamp) * 1000,
57+
summary: txn._summary,
58+
});
59+
}
60+
},
61+
};

components/yahoo_fantasy_sports/sources/new-football-league-transactions/new-football-league-transactions.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "yahoo_fantasy_sports-new-football-league-transactions",
77
name: "New Football League Transactions",
88
description: "Emit new event when a new football league transaction occurs",
9-
version: "0.0.3",
9+
version: "0.0.4",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {

components/yahoo_fantasy_sports/yahoo_fantasy_sports.app.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export default {
1010
type: "string",
1111
label: "League",
1212
description: "Select a league",
13-
async options() {
14-
return this.getLeagueOptions();
13+
async options({ gameKey = "nfl" }) {
14+
return this.getLeagueOptions(gameKey);
1515
},
1616
},
1717
},
@@ -59,9 +59,9 @@ export default {
5959
}
6060
return o;
6161
},
62-
async getLeagueOptions() {
62+
async getLeagueOptions(gameKey = "nfl") {
6363
const resp = await this._makeRequest({
64-
path: "/users;use_login=1/games;game_keys=nfl/leagues/",
64+
path: `/users;use_login=1/games;game_keys=${gameKey}/leagues/`,
6565
});
6666
const users = this.unwrap(resp.fantasy_content.users);
6767
const ret = [];

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)