Skip to content

Commit 2f40fbe

Browse files
committed
SDK regeneration
1 parent cbd7074 commit 2f40fbe

File tree

24 files changed

+112
-439
lines changed

24 files changed

+112
-439
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-
xPdEnvironment: "YOUR_X_PD_ENVIRONMENT",
29-
});
25+
const client = new PipedreamClient({ apiKey: "YOUR_API_KEY", xPdEnvironment: "YOUR_X_PD_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-
xPdEnvironment: "YOUR_X_PD_ENVIRONMENT",
81-
});
73+
const client = new PipedreamClient({ apiKey: "YOUR_API_KEY", xPdEnvironment: "YOUR_X_PD_ENVIRONMENT" });
8274
const response = await client.apps.list();
8375
for await (const item of response) {
8476
console.log(item);

src/Client.ts

Lines changed: 14 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import * as environments from "./environments.js";
66
import * as core from "./core/index.js";
7-
import { OauthTokens } from "./api/resources/oauthTokens/client/Client.js";
87
import { mergeHeaders } from "./core/headers.js";
98
import { AppCategories } from "./api/resources/appCategories/client/Client.js";
109
import { Apps } from "./api/resources/apps/client/Client.js";
@@ -17,15 +16,15 @@ import { DeployedTriggers } from "./api/resources/deployedTriggers/client/Client
1716
import { Projects } from "./api/resources/projects/client/Client.js";
1817
import { Proxy } from "./api/resources/proxy/client/Client.js";
1918
import { Tokens } from "./api/resources/tokens/client/Client.js";
19+
import { OauthTokens } from "./api/resources/oauthTokens/client/Client.js";
2020

2121
export declare namespace PipedreamClient {
2222
export interface Options {
2323
environment?: core.Supplier<environments.PipedreamEnvironment | string>;
2424
/** Specify a custom URL to connect the client to. */
2525
baseUrl?: core.Supplier<string>;
26-
clientId: core.Supplier<string>;
27-
clientSecret: core.Supplier<string>;
2826
projectId: string;
27+
apiKey?: core.Supplier<string | undefined>;
2928
/** Override the x-pd-environment header */
3029
xPdEnvironment?: core.Supplier<string | undefined>;
3130
/** Additional headers to include in requests. */
@@ -48,7 +47,6 @@ export declare namespace PipedreamClient {
4847

4948
export class PipedreamClient {
5049
protected readonly _options: PipedreamClient.Options;
51-
private readonly _oauthTokenProvider: core.OAuthTokenProvider;
5250
protected _appCategories: AppCategories | undefined;
5351
protected _apps: Apps | undefined;
5452
protected _accounts: Accounts | undefined;
@@ -78,98 +76,53 @@ export class PipedreamClient {
7876
_options?.headers,
7977
),
8078
};
81-
82-
this._oauthTokenProvider = new core.OAuthTokenProvider({
83-
clientId: this._options.clientId,
84-
clientSecret: this._options.clientSecret,
85-
authClient: new OauthTokens({
86-
...this._options,
87-
environment: this._options.environment,
88-
}),
89-
});
9079
}
9180

9281
public get appCategories(): AppCategories {
93-
return (this._appCategories ??= new AppCategories({
94-
...this._options,
95-
token: async () => await this._oauthTokenProvider.getToken(),
96-
}));
82+
return (this._appCategories ??= new AppCategories(this._options));
9783
}
9884

9985
public get apps(): Apps {
100-
return (this._apps ??= new Apps({
101-
...this._options,
102-
token: async () => await this._oauthTokenProvider.getToken(),
103-
}));
86+
return (this._apps ??= new Apps(this._options));
10487
}
10588

10689
public get accounts(): Accounts {
107-
return (this._accounts ??= new Accounts({
108-
...this._options,
109-
token: async () => await this._oauthTokenProvider.getToken(),
110-
}));
90+
return (this._accounts ??= new Accounts(this._options));
11191
}
11292

11393
public get users(): Users {
114-
return (this._users ??= new Users({
115-
...this._options,
116-
token: async () => await this._oauthTokenProvider.getToken(),
117-
}));
94+
return (this._users ??= new Users(this._options));
11895
}
11996

12097
public get components(): Components {
121-
return (this._components ??= new Components({
122-
...this._options,
123-
token: async () => await this._oauthTokenProvider.getToken(),
124-
}));
98+
return (this._components ??= new Components(this._options));
12599
}
126100

127101
public get actions(): Actions {
128-
return (this._actions ??= new Actions({
129-
...this._options,
130-
token: async () => await this._oauthTokenProvider.getToken(),
131-
}));
102+
return (this._actions ??= new Actions(this._options));
132103
}
133104

134105
public get triggers(): Triggers {
135-
return (this._triggers ??= new Triggers({
136-
...this._options,
137-
token: async () => await this._oauthTokenProvider.getToken(),
138-
}));
106+
return (this._triggers ??= new Triggers(this._options));
139107
}
140108

141109
public get deployedTriggers(): DeployedTriggers {
142-
return (this._deployedTriggers ??= new DeployedTriggers({
143-
...this._options,
144-
token: async () => await this._oauthTokenProvider.getToken(),
145-
}));
110+
return (this._deployedTriggers ??= new DeployedTriggers(this._options));
146111
}
147112

148113
public get projects(): Projects {
149-
return (this._projects ??= new Projects({
150-
...this._options,
151-
token: async () => await this._oauthTokenProvider.getToken(),
152-
}));
114+
return (this._projects ??= new Projects(this._options));
153115
}
154116

155117
public get proxy(): Proxy {
156-
return (this._proxy ??= new Proxy({
157-
...this._options,
158-
token: async () => await this._oauthTokenProvider.getToken(),
159-
}));
118+
return (this._proxy ??= new Proxy(this._options));
160119
}
161120

162121
public get tokens(): Tokens {
163-
return (this._tokens ??= new Tokens({
164-
...this._options,
165-
token: async () => await this._oauthTokenProvider.getToken(),
166-
}));
122+
return (this._tokens ??= new Tokens(this._options));
167123
}
168124

169125
public get oauthTokens(): OauthTokens {
170-
return (this._oauthTokens ??= new OauthTokens({
171-
...this._options,
172-
token: async () => await this._oauthTokenProvider.getToken(),
173-
}));
126+
return (this._oauthTokens ??= new OauthTokens(this._options));
174127
}
175128
}

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

Lines changed: 9 additions & 13 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+
apiKey?: core.Supplier<string | undefined>;
1818
/** Override the x-pd-environment header */
1919
xPdEnvironment?: core.Supplier<string | undefined>;
2020
/** Additional headers to include in requests. */
@@ -99,8 +99,8 @@ export class Accounts {
9999
headers: mergeHeaders(
100100
this._options?.headers,
101101
mergeOnlyDefinedHeaders({
102-
Authorization: await this._getAuthorizationHeader(),
103102
"x-pd-environment": requestOptions?.xPdEnvironment,
103+
...(await this._getCustomAuthorizationHeaders()),
104104
}),
105105
requestOptions?.headers,
106106
),
@@ -203,8 +203,8 @@ export class Accounts {
203203
headers: mergeHeaders(
204204
this._options?.headers,
205205
mergeOnlyDefinedHeaders({
206-
Authorization: await this._getAuthorizationHeader(),
207206
"x-pd-environment": requestOptions?.xPdEnvironment,
207+
...(await this._getCustomAuthorizationHeaders()),
208208
}),
209209
requestOptions?.headers,
210210
),
@@ -285,8 +285,8 @@ export class Accounts {
285285
headers: mergeHeaders(
286286
this._options?.headers,
287287
mergeOnlyDefinedHeaders({
288-
Authorization: await this._getAuthorizationHeader(),
289288
"x-pd-environment": requestOptions?.xPdEnvironment,
289+
...(await this._getCustomAuthorizationHeaders()),
290290
}),
291291
requestOptions?.headers,
292292
),
@@ -352,8 +352,8 @@ export class Accounts {
352352
headers: mergeHeaders(
353353
this._options?.headers,
354354
mergeOnlyDefinedHeaders({
355-
Authorization: await this._getAuthorizationHeader(),
356355
"x-pd-environment": requestOptions?.xPdEnvironment,
356+
...(await this._getCustomAuthorizationHeaders()),
357357
}),
358358
requestOptions?.headers,
359359
),
@@ -418,8 +418,8 @@ export class Accounts {
418418
headers: mergeHeaders(
419419
this._options?.headers,
420420
mergeOnlyDefinedHeaders({
421-
Authorization: await this._getAuthorizationHeader(),
422421
"x-pd-environment": requestOptions?.xPdEnvironment,
422+
...(await this._getCustomAuthorizationHeaders()),
423423
}),
424424
requestOptions?.headers,
425425
),
@@ -458,12 +458,8 @@ export class Accounts {
458458
}
459459
}
460460

461-
protected async _getAuthorizationHeader(): Promise<string | undefined> {
462-
const bearer = await core.Supplier.get(this._options.token);
463-
if (bearer != null) {
464-
return `Bearer ${bearer}`;
465-
}
466-
467-
return undefined;
461+
protected async _getCustomAuthorizationHeaders() {
462+
const apiKeyValue = await core.Supplier.get(this._options.apiKey);
463+
return { Authorization: apiKeyValue };
468464
}
469465
}

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

Lines changed: 9 additions & 13 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+
apiKey?: core.Supplier<string | undefined>;
1818
/** Override the x-pd-environment header */
1919
xPdEnvironment?: core.Supplier<string | undefined>;
2020
/** Additional headers to include in requests. */
@@ -85,8 +85,8 @@ export class Actions {
8585
headers: mergeHeaders(
8686
this._options?.headers,
8787
mergeOnlyDefinedHeaders({
88-
Authorization: await this._getAuthorizationHeader(),
8988
"x-pd-environment": requestOptions?.xPdEnvironment,
89+
...(await this._getCustomAuthorizationHeaders()),
9090
}),
9191
requestOptions?.headers,
9292
),
@@ -171,8 +171,8 @@ export class Actions {
171171
headers: mergeHeaders(
172172
this._options?.headers,
173173
mergeOnlyDefinedHeaders({
174-
Authorization: await this._getAuthorizationHeader(),
175174
"x-pd-environment": requestOptions?.xPdEnvironment,
175+
...(await this._getCustomAuthorizationHeaders()),
176176
}),
177177
requestOptions?.headers,
178178
),
@@ -247,9 +247,9 @@ export class Actions {
247247
headers: mergeHeaders(
248248
this._options?.headers,
249249
mergeOnlyDefinedHeaders({
250-
Authorization: await this._getAuthorizationHeader(),
251250
"x-async-handle": asyncHandle != null ? asyncHandle : undefined,
252251
"x-pd-environment": requestOptions?.xPdEnvironment,
252+
...(await this._getCustomAuthorizationHeaders()),
253253
}),
254254
requestOptions?.headers,
255255
),
@@ -326,9 +326,9 @@ export class Actions {
326326
headers: mergeHeaders(
327327
this._options?.headers,
328328
mergeOnlyDefinedHeaders({
329-
Authorization: await this._getAuthorizationHeader(),
330329
"x-async-handle": asyncHandle != null ? asyncHandle : undefined,
331330
"x-pd-environment": requestOptions?.xPdEnvironment,
331+
...(await this._getCustomAuthorizationHeaders()),
332332
}),
333333
requestOptions?.headers,
334334
),
@@ -403,9 +403,9 @@ export class Actions {
403403
headers: mergeHeaders(
404404
this._options?.headers,
405405
mergeOnlyDefinedHeaders({
406-
Authorization: await this._getAuthorizationHeader(),
407406
"x-async-handle": asyncHandle != null ? asyncHandle : undefined,
408407
"x-pd-environment": requestOptions?.xPdEnvironment,
408+
...(await this._getCustomAuthorizationHeaders()),
409409
}),
410410
requestOptions?.headers,
411411
),
@@ -447,12 +447,8 @@ export class Actions {
447447
}
448448
}
449449

450-
protected async _getAuthorizationHeader(): Promise<string | undefined> {
451-
const bearer = await core.Supplier.get(this._options.token);
452-
if (bearer != null) {
453-
return `Bearer ${bearer}`;
454-
}
455-
456-
return undefined;
450+
protected async _getCustomAuthorizationHeaders() {
451+
const apiKeyValue = await core.Supplier.get(this._options.apiKey);
452+
return { Authorization: apiKeyValue };
457453
}
458454
}

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

Lines changed: 6 additions & 10 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+
apiKey?: core.Supplier<string | undefined>;
1818
/** Override the x-pd-environment header */
1919
xPdEnvironment?: core.Supplier<string | undefined>;
2020
/** Additional headers to include in requests. */
@@ -68,8 +68,8 @@ export class AppCategories {
6868
headers: mergeHeaders(
6969
this._options?.headers,
7070
mergeOnlyDefinedHeaders({
71-
Authorization: await this._getAuthorizationHeader(),
7271
"x-pd-environment": requestOptions?.xPdEnvironment,
72+
...(await this._getCustomAuthorizationHeaders()),
7373
}),
7474
requestOptions?.headers,
7575
),
@@ -135,8 +135,8 @@ export class AppCategories {
135135
headers: mergeHeaders(
136136
this._options?.headers,
137137
mergeOnlyDefinedHeaders({
138-
Authorization: await this._getAuthorizationHeader(),
139138
"x-pd-environment": requestOptions?.xPdEnvironment,
139+
...(await this._getCustomAuthorizationHeaders()),
140140
}),
141141
requestOptions?.headers,
142142
),
@@ -175,12 +175,8 @@ export class AppCategories {
175175
}
176176
}
177177

178-
protected async _getAuthorizationHeader(): Promise<string | undefined> {
179-
const bearer = await core.Supplier.get(this._options.token);
180-
if (bearer != null) {
181-
return `Bearer ${bearer}`;
182-
}
183-
184-
return undefined;
178+
protected async _getCustomAuthorizationHeaders() {
179+
const apiKeyValue = await core.Supplier.get(this._options.apiKey);
180+
return { Authorization: apiKeyValue };
185181
}
186182
}

0 commit comments

Comments
 (0)