Skip to content

Commit 24a03de

Browse files
committed
SDK regeneration
1 parent acc9221 commit 24a03de

File tree

19 files changed

+64
-191
lines changed

19 files changed

+64
-191
lines changed

README.md

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

25-
const client = new PipedreamClient({
26-
clientId: "YOUR_CLIENT_ID",
27-
clientSecret: "YOUR_CLIENT_SECRET",
28-
projectEnvironment: "YOUR_PROJECT_ENVIRONMENT",
29-
});
25+
const client = new PipedreamClient({ token: "YOUR_TOKEN", projectEnvironment: "YOUR_PROJECT_ENVIRONMENT" });
3026
await client.accounts.create({
3127
app_slug: "app_slug",
3228
cfmap_json: "cfmap_json",
@@ -74,11 +70,7 @@ List endpoints are paginated. The SDK provides an iterator so that you can simpl
7470
```typescript
7571
import { PipedreamClient } from "@pipedream/sdk";
7672

77-
const client = new PipedreamClient({
78-
clientId: "YOUR_CLIENT_ID",
79-
clientSecret: "YOUR_CLIENT_SECRET",
80-
projectEnvironment: "YOUR_PROJECT_ENVIRONMENT",
81-
});
73+
const client = new PipedreamClient({ token: "YOUR_TOKEN", projectEnvironment: "YOUR_PROJECT_ENVIRONMENT" });
8274
const response = await client.apps.list();
8375
for await (const item of response) {
8476
console.log(item);

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",

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+
token?: 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ export class Accounts {
459459
}
460460

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
452452
if (bearer != null) {
453453
return `Bearer ${bearer}`;
454454
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
180180
if (bearer != null) {
181181
return `Bearer ${bearer}`;
182182
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
225225
if (bearer != null) {
226226
return `Bearer ${bearer}`;
227227
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
375375
if (bearer != null) {
376376
return `Bearer ${bearer}`;
377377
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ export class DeployedTriggers {
789789
}
790790

791791
protected async _getAuthorizationHeader(): Promise<string | undefined> {
792-
const bearer = await core.Supplier.get(this._options.token);
792+
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
793793
if (bearer != null) {
794794
return `Bearer ${bearer}`;
795795
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class OauthTokens {
116116
}
117117

118118
protected async _getAuthorizationHeader(): Promise<string | undefined> {
119-
const bearer = await core.Supplier.get(this._options.token);
119+
const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["PIPEDREAM_ACCESS_TOKEN"];
120120
if (bearer != null) {
121121
return `Bearer ${bearer}`;
122122
}

0 commit comments

Comments
 (0)