Skip to content

Commit 128abdb

Browse files
committed
feat(sdk): add limit option to apps, components, accounts (1.0.11)
1 parent a08659e commit 128abdb

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

packages/sdk/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<!-- markdownlint-disable MD024 -->
22
# Changelog
33

4+
## [1.0.11] - 2024-12-04
5+
6+
### Added
7+
8+
- Configurable `limit` option for apps, accounts, components endpoints
9+
410
## [1.0.10] - 2024-12-04
511

612
### Changed

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/sdk",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"description": "Pipedream SDK",
55
"main": "dist/server/server/index.js",
66
"module": "dist/server/server/index.js",

packages/sdk/src/shared/index.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,14 @@ export type ComponentConfigureResponse = {
9595
errors: string[];
9696
};
9797

98+
export type RelationOpts = {
99+
limit?: number
100+
}
101+
98102
/**
99103
* Parameters for the retrieval of apps from the Connect API
100104
*/
101-
export type GetAppsOpts = {
105+
export type GetAppsOpts = RelationOpts & {
102106
/**
103107
* A search query to filter the apps.
104108
*/
@@ -108,7 +112,7 @@ export type GetAppsOpts = {
108112
/**
109113
* Parameters for the retrieval of accounts from the Connect API
110114
*/
111-
export type GetAccountOpts = {
115+
export type GetAccountOpts = RelationOpts & {
112116
/**
113117
* The ID or name slug of the app, in case you want to only retrieve the
114118
* accounts for a specific app.
@@ -201,7 +205,7 @@ export type ComponentConfigureOpts = {
201205
query?: string;
202206
};
203207

204-
export type GetComponentOpts = {
208+
export type GetComponentOpts = RelationOpts & {
205209
q?: string;
206210
app?: string;
207211
componentType?: "trigger" | "action";
@@ -519,6 +523,9 @@ export abstract class BaseClient {
519523
if (opts?.q) {
520524
params.q = opts.q;
521525
}
526+
if (opts?.limit != null) {
527+
params.limit = "" + opts.limit
528+
}
522529
const resp = await this.makeAuthorizedRequest<AppsRequestResponse>(
523530
"/apps",
524531
{
@@ -539,15 +546,14 @@ export abstract class BaseClient {
539546

540547
// XXX only here while need project auth
541548
public async components(opts?: GetComponentOpts) {
542-
const params: Record<string, string> = {
543-
limit: "20",
544-
};
549+
const params: Record<string, string> = {};
545550
if (opts?.app) {
546551
params.app = opts.app;
547552
}
548553
if (opts?.q) {
549554
params.q = opts.q;
550555
}
556+
params.limit = "" + (opts?.limit ?? 20)
551557
// XXX can just use /components and ?type instead when supported
552558
let path = "/components";
553559
if (opts?.componentType === "trigger") {

pnpm-lock.yaml

Lines changed: 0 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)