From 047fc84472b0350422196a7898bd98f805971fc4 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Mon, 22 Sep 2025 13:21:35 -0400 Subject: [PATCH] new action list-policies --- .../actions/list-policies/list-policies.ts | 36 +++++++++++++++++++ components/expensify/package.json | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 components/expensify/actions/list-policies/list-policies.ts diff --git a/components/expensify/actions/list-policies/list-policies.ts b/components/expensify/actions/list-policies/list-policies.ts new file mode 100644 index 0000000000000..ea21ce50e4b36 --- /dev/null +++ b/components/expensify/actions/list-policies/list-policies.ts @@ -0,0 +1,36 @@ +import { defineAction } from "@pipedream/types"; +import expensify from "../../app/expensify.app"; + +export default defineAction({ + key: "expensify-list-policies", + name: "List Policies", + description: "Retrieves a list of policies. [See the documentation](https://integrations.expensify.com/Integration-Server/doc/#policy-list-getter)", + version: "0.0.1", + type: "action", + props: { + expensify, + adminOnly: { + type: "boolean", + label: "Admin Only", + description: "Whether or not to only get policies for which the user is an admin", + optional: true, + }, + userEmail: { + type: "string", + label: "User Email", + description: "Specifies the user to gather the policy list for. You must have been granted third-party access by that user/company domain beforehand.", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.expensify.getPolicyList({ + $, + userEmail: this.userEmail, + adminOnly: this.adminOnly, + }); + + $.export("$summary", `Successfully retrieved ${response?.policyList?.length || 0} policies`); + + return response?.policyList || []; + }, +}) diff --git a/components/expensify/package.json b/components/expensify/package.json index bea532e7eb6eb..182dfef645c5c 100644 --- a/components/expensify/package.json +++ b/components/expensify/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/expensify", - "version": "0.2.0", + "version": "0.3.0", "description": "Pipedream Expensify Components", "main": "dist/app/expensify.app.mjs", "keywords": [