Skip to content

Commit 81ba768

Browse files
committed
SDK regeneration
1 parent acc9221 commit 81ba768

File tree

21 files changed

+54
-185
lines changed

21 files changed

+54
-185
lines changed

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ Instantiate and use the client with the following:
2323
import { PipedreamClient } from "@pipedream/sdk";
2424

2525
const client = new PipedreamClient({
26-
clientId: "YOUR_CLIENT_ID",
27-
clientSecret: "YOUR_CLIENT_SECRET",
26+
accessToken: "YOUR_ACCESS_TOKEN",
2827
projectEnvironment: "YOUR_PROJECT_ENVIRONMENT",
2928
});
3029
await client.accounts.create({
3130
app_slug: "app_slug",
32-
cfmap_json: "cfmap_json",
33-
connect_token: "connect_token",
3431
});
3532
```
3633

@@ -75,8 +72,7 @@ List endpoints are paginated. The SDK provides an iterator so that you can simpl
7572
import { PipedreamClient } from "@pipedream/sdk";
7673

7774
const client = new PipedreamClient({
78-
clientId: "YOUR_CLIENT_ID",
79-
clientSecret: "YOUR_CLIENT_SECRET",
75+
accessToken: "YOUR_ACCESS_TOKEN",
8076
projectEnvironment: "YOUR_PROJECT_ENVIRONMENT",
8177
});
8278
const response = await client.apps.list();

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": "2.0.0",
3+
"version": "1.7.1",
44
"private": false,
55
"repository": "github:PipedreamHQ/pipedream-sdk-typescript",
66
"type": "commonjs",

reference.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,6 @@ while (page.hasNextPage()) {
271271
```typescript
272272
await client.accounts.create({
273273
app_slug: "app_slug",
274-
cfmap_json: "cfmap_json",
275-
connect_token: "connect_token",
276274
});
277275
```
278276

src/Client.ts

Lines changed: 14 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import * as environments from "./environments.js";
66
import * as core from "./core/index.js";
77
import * as Pipedream from "./api/index.js";
8-
import { OauthTokens } from "./api/resources/oauthTokens/client/Client.js";
98
import { mergeHeaders } from "./core/headers.js";
109
import { AppCategories } from "./api/resources/appCategories/client/Client.js";
1110
import { Apps } from "./api/resources/apps/client/Client.js";
@@ -18,15 +17,15 @@ import { DeployedTriggers } from "./api/resources/deployedTriggers/client/Client
1817
import { Projects } from "./api/resources/projects/client/Client.js";
1918
import { Proxy } from "./api/resources/proxy/client/Client.js";
2019
import { Tokens } from "./api/resources/tokens/client/Client.js";
20+
import { OauthTokens } from "./api/resources/oauthTokens/client/Client.js";
2121

2222
export declare namespace PipedreamClient {
2323
export interface Options {
2424
environment?: core.Supplier<environments.PipedreamEnvironment | string>;
2525
/** Specify a custom URL to connect the client to. */
2626
baseUrl?: core.Supplier<string>;
27-
clientId?: core.Supplier<string>;
28-
clientSecret?: core.Supplier<string>;
2927
projectId: string;
28+
accessToken?: core.Supplier<core.BearerToken | undefined>;
3029
/** Override the x-pd-environment header */
3130
projectEnvironment?: core.Supplier<Pipedream.ProjectEnvironment | undefined>;
3231
/** Additional headers to include in requests. */
@@ -49,7 +48,6 @@ export declare namespace PipedreamClient {
4948

5049
export class PipedreamClient {
5150
protected readonly _options: PipedreamClient.Options;
52-
private readonly _oauthTokenProvider: core.OAuthTokenProvider;
5351
protected _appCategories: AppCategories | undefined;
5452
protected _apps: Apps | undefined;
5553
protected _accounts: Accounts | undefined;
@@ -79,112 +77,53 @@ export class PipedreamClient {
7977
_options?.headers,
8078
),
8179
};
82-
83-
const clientId = this._options.clientId ?? process.env["PIPEDREAM_CLIENT_ID"];
84-
if (clientId == null) {
85-
throw new Error(
86-
"clientId is required; either pass it as an argument or set the PIPEDREAM_CLIENT_ID environment variable",
87-
);
88-
}
89-
90-
const clientSecret = this._options.clientSecret ?? process.env["PIPEDREAM_CLIENT_SECRET"];
91-
if (clientSecret == null) {
92-
throw new Error(
93-
"clientSecret is required; either pass it as an argument or set the PIPEDREAM_CLIENT_SECRET environment variable",
94-
);
95-
}
96-
97-
this._oauthTokenProvider = new core.OAuthTokenProvider({
98-
clientId,
99-
clientSecret,
100-
authClient: new OauthTokens({
101-
...this._options,
102-
environment: this._options.environment,
103-
}),
104-
});
10580
}
10681

10782
public get appCategories(): AppCategories {
108-
return (this._appCategories ??= new AppCategories({
109-
...this._options,
110-
token: async () => await this._oauthTokenProvider.getToken(),
111-
}));
83+
return (this._appCategories ??= new AppCategories(this._options));
11284
}
11385

11486
public get apps(): Apps {
115-
return (this._apps ??= new Apps({
116-
...this._options,
117-
token: async () => await this._oauthTokenProvider.getToken(),
118-
}));
87+
return (this._apps ??= new Apps(this._options));
11988
}
12089

12190
public get accounts(): Accounts {
122-
return (this._accounts ??= new Accounts({
123-
...this._options,
124-
token: async () => await this._oauthTokenProvider.getToken(),
125-
}));
91+
return (this._accounts ??= new Accounts(this._options));
12692
}
12793

12894
public get users(): Users {
129-
return (this._users ??= new Users({
130-
...this._options,
131-
token: async () => await this._oauthTokenProvider.getToken(),
132-
}));
95+
return (this._users ??= new Users(this._options));
13396
}
13497

13598
public get components(): Components {
136-
return (this._components ??= new Components({
137-
...this._options,
138-
token: async () => await this._oauthTokenProvider.getToken(),
139-
}));
99+
return (this._components ??= new Components(this._options));
140100
}
141101

142102
public get actions(): Actions {
143-
return (this._actions ??= new Actions({
144-
...this._options,
145-
token: async () => await this._oauthTokenProvider.getToken(),
146-
}));
103+
return (this._actions ??= new Actions(this._options));
147104
}
148105

149106
public get triggers(): Triggers {
150-
return (this._triggers ??= new Triggers({
151-
...this._options,
152-
token: async () => await this._oauthTokenProvider.getToken(),
153-
}));
107+
return (this._triggers ??= new Triggers(this._options));
154108
}
155109

156110
public get deployedTriggers(): DeployedTriggers {
157-
return (this._deployedTriggers ??= new DeployedTriggers({
158-
...this._options,
159-
token: async () => await this._oauthTokenProvider.getToken(),
160-
}));
111+
return (this._deployedTriggers ??= new DeployedTriggers(this._options));
161112
}
162113

163114
public get projects(): Projects {
164-
return (this._projects ??= new Projects({
165-
...this._options,
166-
token: async () => await this._oauthTokenProvider.getToken(),
167-
}));
115+
return (this._projects ??= new Projects(this._options));
168116
}
169117

170118
public get proxy(): Proxy {
171-
return (this._proxy ??= new Proxy({
172-
...this._options,
173-
token: async () => await this._oauthTokenProvider.getToken(),
174-
}));
119+
return (this._proxy ??= new Proxy(this._options));
175120
}
176121

177122
public get tokens(): Tokens {
178-
return (this._tokens ??= new Tokens({
179-
...this._options,
180-
token: async () => await this._oauthTokenProvider.getToken(),
181-
}));
123+
return (this._tokens ??= new Tokens(this._options));
182124
}
183125

184126
public get oauthTokens(): OauthTokens {
185-
return (this._oauthTokens ??= new OauthTokens({
186-
...this._options,
187-
token: async () => await this._oauthTokenProvider.getToken(),
188-
}));
127+
return (this._oauthTokens ??= new OauthTokens(this._options));
189128
}
190129
}

src/api/resources/accounts/client/Client.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export declare namespace Accounts {
1414
/** Specify a custom URL to connect the client to. */
1515
baseUrl?: core.Supplier<string>;
1616
projectId: string;
17-
token?: core.Supplier<core.BearerToken | undefined>;
17+
accessToken?: core.Supplier<core.BearerToken | undefined>;
1818
/** Override the x-pd-environment header */
1919
projectEnvironment?: core.Supplier<Pipedream.ProjectEnvironment | undefined>;
2020
/** Additional headers to include in requests. */
@@ -162,9 +162,7 @@ export class Accounts {
162162
*
163163
* @example
164164
* await client.accounts.create({
165-
* app_slug: "app_slug",
166-
* cfmap_json: "cfmap_json",
167-
* connect_token: "connect_token"
165+
* app_slug: "app_slug"
168166
* })
169167
*/
170168
public create(
@@ -459,7 +457,7 @@ export class Accounts {
459457
}
460458

461459
protected async _getAuthorizationHeader(): Promise<string | undefined> {
462-
const bearer = await core.Supplier.get(this._options.token);
460+
const bearer = (await core.Supplier.get(this._options.accessToken)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
463461
if (bearer != null) {
464462
return `Bearer ${bearer}`;
465463
}

src/api/resources/accounts/client/requests/CreateAccountRequest.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
/**
66
* @example
77
* {
8-
* app_slug: "app_slug",
9-
* cfmap_json: "cfmap_json",
10-
* connect_token: "connect_token"
8+
* app_slug: "app_slug"
119
* }
1210
*/
1311
export interface CreateAccountRequest {
@@ -23,9 +21,7 @@ export interface CreateAccountRequest {
2321
/** The app slug for the account */
2422
app_slug: string;
2523
/** JSON string containing the custom fields mapping */
26-
cfmap_json: string;
27-
/** The connect token for authentication */
28-
connect_token: string;
24+
cfmap_json?: string;
2925
/** Optional name for the account */
3026
name?: string;
3127
}

src/api/resources/actions/client/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export declare namespace Actions {
1414
/** Specify a custom URL to connect the client to. */
1515
baseUrl?: core.Supplier<string>;
1616
projectId: string;
17-
token?: core.Supplier<core.BearerToken | undefined>;
17+
accessToken?: core.Supplier<core.BearerToken | undefined>;
1818
/** Override the x-pd-environment header */
1919
projectEnvironment?: core.Supplier<Pipedream.ProjectEnvironment | undefined>;
2020
/** Additional headers to include in requests. */
@@ -448,7 +448,7 @@ export class Actions {
448448
}
449449

450450
protected async _getAuthorizationHeader(): Promise<string | undefined> {
451-
const bearer = await core.Supplier.get(this._options.token);
451+
const bearer = (await core.Supplier.get(this._options.accessToken)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
452452
if (bearer != null) {
453453
return `Bearer ${bearer}`;
454454
}

src/api/resources/appCategories/client/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export declare namespace AppCategories {
1414
/** Specify a custom URL to connect the client to. */
1515
baseUrl?: core.Supplier<string>;
1616
projectId: string;
17-
token?: core.Supplier<core.BearerToken | undefined>;
17+
accessToken?: core.Supplier<core.BearerToken | undefined>;
1818
/** Override the x-pd-environment header */
1919
projectEnvironment?: core.Supplier<Pipedream.ProjectEnvironment | undefined>;
2020
/** Additional headers to include in requests. */
@@ -176,7 +176,7 @@ export class AppCategories {
176176
}
177177

178178
protected async _getAuthorizationHeader(): Promise<string | undefined> {
179-
const bearer = await core.Supplier.get(this._options.token);
179+
const bearer = (await core.Supplier.get(this._options.accessToken)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
180180
if (bearer != null) {
181181
return `Bearer ${bearer}`;
182182
}

src/api/resources/apps/client/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export declare namespace Apps {
1414
/** Specify a custom URL to connect the client to. */
1515
baseUrl?: core.Supplier<string>;
1616
projectId: string;
17-
token?: core.Supplier<core.BearerToken | undefined>;
17+
accessToken?: core.Supplier<core.BearerToken | undefined>;
1818
/** Override the x-pd-environment header */
1919
projectEnvironment?: core.Supplier<Pipedream.ProjectEnvironment | undefined>;
2020
/** Additional headers to include in requests. */
@@ -221,7 +221,7 @@ export class Apps {
221221
}
222222

223223
protected async _getAuthorizationHeader(): Promise<string | undefined> {
224-
const bearer = await core.Supplier.get(this._options.token);
224+
const bearer = (await core.Supplier.get(this._options.accessToken)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
225225
if (bearer != null) {
226226
return `Bearer ${bearer}`;
227227
}

src/api/resources/components/client/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export declare namespace Components {
1414
/** Specify a custom URL to connect the client to. */
1515
baseUrl?: core.Supplier<string>;
1616
projectId: string;
17-
token?: core.Supplier<core.BearerToken | undefined>;
17+
accessToken?: core.Supplier<core.BearerToken | undefined>;
1818
/** Override the x-pd-environment header */
1919
projectEnvironment?: core.Supplier<Pipedream.ProjectEnvironment | undefined>;
2020
/** Additional headers to include in requests. */
@@ -371,7 +371,7 @@ export class Components {
371371
}
372372

373373
protected async _getAuthorizationHeader(): Promise<string | undefined> {
374-
const bearer = await core.Supplier.get(this._options.token);
374+
const bearer = (await core.Supplier.get(this._options.accessToken)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
375375
if (bearer != null) {
376376
return `Bearer ${bearer}`;
377377
}

0 commit comments

Comments
 (0)