Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/yahoo_fantasy_sports/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/yahoo_fantasy_sports",
"version": "0.3.7",
"version": "0.4.0",
"description": "Pipedream Yahoo_fantasy_sports Components",
"main": "yahoo_fantasy_sports.app.mjs",
"keywords": [
Expand All @@ -14,6 +14,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.2.0"
"@pipedream/platform": "^3.1.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import yfs from "../../yahoo_fantasy_sports.app.mjs";
import options from "../common/options.mjs";
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";

export default {
key: "yahoo_fantasy_sports-new-baseball-league-transactions",
name: "New Baseball League Transactions",
description: "Emit new event when a new baseball league transaction occurs",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
yfs,
league: {
propDefinition: [
yfs,
"league",
() => ({
gameKey: "mlb",
}),
],
},
eventTypes: {
type: "string[]",
label: "Event Types",
description: "Select the types of events to watch for",
options: options.EVENT_TYPES,
optional: true,
default: [
"*",
],
},
timer: {
label: "Polling interval",
description: "Pipedream will poll the API on this schedule",
type: "$.interface.timer",
default: {
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},
},
async run() {
const eventTypes = this.eventTypes.includes("*")
? options.ALL_EVENT_TYPES
: this.eventTypes;

const transactions = await this.yfs.getLeagueTransactions(this.league, eventTypes);
if (Object.keys(transactions).length === 0) {
return;
}

for (const txn of transactions) {
txn._summary = this.yfs.transactionSummary(txn);
this.$emit(txn, {
id: txn.transaction_key,
ts: (+txn.timestamp) * 1000,
summary: txn._summary,
});
}
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "yahoo_fantasy_sports-new-football-league-transactions",
name: "New Football League Transactions",
description: "Emit new event when a new football league transaction occurs",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
props: {
Expand Down
8 changes: 4 additions & 4 deletions components/yahoo_fantasy_sports/yahoo_fantasy_sports.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default {
type: "string",
label: "League",
description: "Select a league",
async options() {
return this.getLeagueOptions();
async options({ gameKey = "nfl" }) {
return this.getLeagueOptions(gameKey);
},
},
},
Expand Down Expand Up @@ -59,9 +59,9 @@ export default {
}
return o;
},
async getLeagueOptions() {
async getLeagueOptions(gameKey = "nfl") {
const resp = await this._makeRequest({
path: "/users;use_login=1/games;game_keys=nfl/leagues/",
path: `/users;use_login=1/games;game_keys=${gameKey}/leagues/`,
});
const users = this.unwrap(resp.fantasy_content.users);
const ret = [];
Expand Down
15 changes: 7 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading