Skip to content

Commit f5d7c0c

Browse files
committed
Updating more client references
1 parent 3e2b4f5 commit f5d7c0c

File tree

4 files changed

+83
-85
lines changed

4 files changed

+83
-85
lines changed

docs-v2/pages/connect/api.mdx

Lines changed: 68 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ Most of your interactions with the Connect API will happen on the server, to pro
5050
[Create a Pipedream OAuth client](/rest-api/auth#oauth) and instantiate the SDK with your client ID and secret:
5151

5252
```typescript
53-
import { createClient } from "@pipedream/sdk";
53+
import { createBackendClient } from "@pipedream/sdk";
5454

5555
// These secrets should be saved securely and passed to your environment
56-
const pd = createClient({
57-
oauth: {
56+
const pd = createBackendClient({
57+
credentials: {
5858
clientId: "your-oauth-client-id",
5959
clientSecret: "your-oauth-client-secret",
6060
}
@@ -73,8 +73,7 @@ You'll primarily use the browser SDK to let your users securely connect apps fro
7373
Here's a Next.js example [from our quickstart](/connect/quickstart):
7474

7575
```typescript
76-
// Note that we import the browser-specific SDK client here
77-
import { createClient } from "@pipedream/sdk/browser"
76+
import { createFrontendClient } from "@pipedream/sdk"
7877
// Example from our Next.js app
7978
import { serverConnectTokenCreate } from "./server"
8079

@@ -83,7 +82,7 @@ const { token, expires_at } = await serverConnectTokenCreate({
8382
});
8483

8584
export default function Home() {
86-
const pd = createClient({})
85+
const pd = createFrontendClient()
8786
function connectAccount() {
8887
pd.connectAccount({
8988
app: appSlug,
@@ -128,11 +127,11 @@ You can use the SDK to invoke workflows on behalf of any end user. **Write one w
128127
<Tabs items={['TypeScript', 'Node.js']}>
129128
<Tabs.Tab>
130129
```typescript
131-
import { createClient, HTTPAuthType } from "@pipedream/sdk";
130+
import { createBackendClient, HTTPAuthType } from "@pipedream/sdk";
132131

133132
// These secrets should be saved securely and passed to your environment
134-
const pd = createClient({
135-
oauth: {
133+
const pd = createBackendClient({
134+
credentials: {
136135
clientId: "YOUR_CLIENT_ID",
137136
clientSecret: "YOUR_CLIENT_SECRET",
138137
},
@@ -153,11 +152,11 @@ await pd.invokeWorkflowForExternalUser(
153152
</Tabs.Tab>
154153
<Tabs.Tab>
155154
```javascript
156-
import { createClient } from "@pipedream/sdk";
155+
import { createBackendClient } from "@pipedream/sdk";
157156

158157
// These secrets should be saved securely and passed to your environment
159-
const pd = createClient({
160-
oauth: {
158+
const pd = createBackendClient({
159+
credentials: {
161160
clientId: "YOUR_CLIENT_ID",
162161
clientSecret: "YOUR_CLIENT_SECRET",
163162
},
@@ -230,45 +229,45 @@ Specify the environment (`production` or `development`) to use for the account c
230229

231230
##### Examples
232231

233-
To create a short-lived token via TypeScript / JavaScript SDK, you'll need to create a Pipedream API client and call the `connectTokenCreate` method. In our example app, this code is in `app/server.ts`.
232+
To create a short-lived token via TypeScript / JavaScript SDK, you'll need to create a Pipedream API client and call the `createConnectToken` method. In our example app, this code is in `app/server.ts`.
234233

235234
In other languages, you'll need to make an HTTP POST request to the `/tokens` endpoint to create a token, then return the token to your frontend. Click into other tabs to see examples in additional languages.
236235

237236
<Tabs items={['TypeScript', 'Node.js', 'HTTP (cURL)']}>
238237
<Tabs.Tab>
239238
```typescript
240239
import {
241-
createClient,
240+
createBackendClient,
242241
type ConnectAPIResponse,
243242
type ConnectTokenCreateOpts,
244243
type ConnectTokenResponse,
245244
} from "@pipedream/sdk";
246245

247-
const pd = createClient({
248-
oauth: {
246+
const pd = createBackendClient({
247+
credentials: {
249248
clientId: "your-oauth-client-id",
250249
clientSecret: "your-oauth-client-secret",
251250
}
252251
});
253252

254-
const { token, expires_at } = await pd.connectTokenCreate({
253+
const { token, expires_at } = await pd.createConnectToken({
255254
project_id: "your-project-id",
256255
external_user_id: "your-external-user-id" // The end user's ID in your system
257256
});
258257
```
259258
</Tabs.Tab>
260259
<Tabs.Tab>
261260
```javascript
262-
import { createClient } from "@pipedream/sdk";
261+
import { createBackendClient } from "@pipedream/sdk";
263262

264-
const pd = createClient({
265-
oauth: {
263+
const pd = createBackendClient({
264+
credentials: {
266265
clientId: "your-oauth-client-id",
267266
clientSecret: "your-oauth-client-secret",
268267
},
269268
});
270269

271-
const { token, expires_at } = await pd.connectTokenCreate({
270+
const { token, expires_at } = await pd.createConnectToken({
272271
project_id: "your-project-id",
273272
external_user_id: "your-external-user-id", // The end user's ID in your system
274273
});
@@ -325,11 +324,11 @@ Pass `include_credentials=true` as a query-string parameter to include the accou
325324
<Tabs.Tab>
326325
```typescript
327326
import {
328-
createClient,
327+
createBackendClient,
329328
} from "@pipedream/sdk";
330329

331-
const pd = createClient({
332-
oauth: {
330+
const pd = createBackendClient({
331+
credentials: {
333332
clientId: "your-oauth-client-id",
334333
clientSecret: "your-oauth-client-secret",
335334
}
@@ -345,10 +344,10 @@ const accounts = await pd.getAccounts({
345344
</Tabs.Tab>
346345
<Tabs.Tab>
347346
```javascript
348-
import { createClient } from "@pipedream/sdk";
347+
import { createBackendClient } from "@pipedream/sdk";
349348

350-
const pd = createClient({
351-
oauth: {
349+
const pd = createBackendClient({
350+
credentials: {
352351
clientId: "your-oauth-client-id",
353352
clientSecret: "your-oauth-client-secret",
354353
}
@@ -487,11 +486,11 @@ Pass `include_credentials=true` as a query-string parameter to include the accou
487486
<Tabs.Tab>
488487
```typescript
489488
import {
490-
createClient,
489+
createBackendClient,
491490
} from "@pipedream/sdk";
492491

493-
const pd = createClient({
494-
oauth: {
492+
const pd = createBackendClient({
493+
credentials: {
495494
clientId: "your-oauth-client-id",
496495
clientSecret: "your-oauth-client-secret",
497496
}
@@ -507,10 +506,10 @@ const accounts = await pd.getAccountsByApp(appId, {
507506
</Tabs.Tab>
508507
<Tabs.Tab>
509508
```javascript
510-
import { createClient } from "@pipedream/sdk";
509+
import { createBackendClient } from "@pipedream/sdk";
511510

512-
const pd = createClient({
513-
oauth: {
511+
const pd = createBackendClient({
512+
credentials: {
514513
clientId: "your-oauth-client-id",
515514
clientSecret: "your-oauth-client-secret",
516515
}
@@ -601,11 +600,11 @@ Pass `include_credentials=true` as a query-string parameter to include the accou
601600
<Tabs.Tab>
602601
```typescript
603602
import {
604-
createClient,
603+
createBackendClient,
605604
} from "@pipedream/sdk";
606605

607-
const pd = createClient({
608-
oauth: {
606+
const pd = createBackendClient({
607+
credentials: {
609608
clientId: "your-oauth-client-id",
610609
clientSecret: "your-oauth-client-secret",
611610
}
@@ -621,10 +620,10 @@ const account = await pd.getAccount(accountId, {
621620
</Tabs.Tab>
622621
<Tabs.Tab>
623622
```javascript
624-
import { createClient } from "@pipedream/sdk";
623+
import { createBackendClient } from "@pipedream/sdk";
625624

626-
const pd = createClient({
627-
oauth: {
625+
const pd = createBackendClient({
626+
credentials: {
628627
clientId: "your-oauth-client-id",
629628
clientSecret: "your-oauth-client-secret",
630629
}
@@ -749,11 +748,11 @@ Pass `include_credentials=true` as a query-string parameter to include the accou
749748
<Tabs.Tab>
750749
```typescript
751750
import {
752-
createClient,
751+
createBackendClient,
753752
} from "@pipedream/sdk";
754753

755-
const pd = createClient({
756-
oauth: {
754+
const pd = createBackendClient({
755+
credentials: {
757756
clientId: "your-oauth-client-id",
758757
clientSecret: "your-oauth-client-secret",
759758
}
@@ -769,10 +768,10 @@ await pd.getAccountsByExternalId(externalId, {
769768
</Tabs.Tab>
770769
<Tabs.Tab>
771770
```javascript
772-
import { createClient } from "@pipedream/sdk";
771+
import { createBackendClient } from "@pipedream/sdk";
773772

774-
const pd = createClient({
775-
oauth: {
773+
const pd = createBackendClient({
774+
credentials: {
776775
clientId: "your-oauth-client-id",
777776
clientSecret: "your-oauth-client-secret",
778777
}
@@ -956,11 +955,11 @@ DELETE /{project_id}/accounts/{account_id}
956955
<Tabs.Tab>
957956
```typescript
958957
import {
959-
createClient,
958+
createBackendClient,
960959
} from "@pipedream/sdk";
961960

962-
const pd = createClient({
963-
oauth: {
961+
const pd = createBackendClient({
962+
credentials: {
964963
clientId: "your-oauth-client-id",
965964
clientSecret: "your-oauth-client-secret",
966965
}
@@ -973,10 +972,10 @@ await pd.deleteAccount(accountId);
973972
</Tabs.Tab>
974973
<Tabs.Tab>
975974
```javascript
976-
import { createClient } from "@pipedream/sdk";
975+
import { createBackendClient } from "@pipedream/sdk";
977976

978-
const pd = createClient({
979-
oauth: {
977+
const pd = createBackendClient({
978+
credentials: {
980979
clientId: "your-oauth-client-id",
981980
clientSecret: "your-oauth-client-secret",
982981
}
@@ -1036,11 +1035,11 @@ The app ID for which you want to delete all connected accounts. `app_id` can be
10361035
<Tabs.Tab>
10371036
```typescript
10381037
import {
1039-
createClient,
1038+
createBackendClient,
10401039
} from "@pipedream/sdk";
10411040

1042-
const pd = createClient({
1043-
oauth: {
1041+
const pd = createBackendClient({
1042+
credentials: {
10441043
clientId: "your-oauth-client-id",
10451044
clientSecret: "your-oauth-client-secret",
10461045
}
@@ -1053,10 +1052,10 @@ await pd.deleteAccountsByApp(appId);
10531052
</Tabs.Tab>
10541053
<Tabs.Tab>
10551054
```javascript
1056-
import { createClient } from "@pipedream/sdk";
1055+
import { createBackendClient } from "@pipedream/sdk";
10571056

1058-
const pd = createClient({
1059-
oauth: {
1057+
const pd = createBackendClient({
1058+
credentials: {
10601059
clientId: "your-oauth-client-id",
10611060
clientSecret: "your-oauth-client-secret",
10621061
}
@@ -1116,11 +1115,11 @@ DELETE /{project_id}/users/{external_user_id}
11161115
<Tabs.Tab>
11171116
```typescript
11181117
import {
1119-
createClient,
1118+
createBackendClient,
11201119
} from "@pipedream/sdk";
11211120

1122-
const pd = createClient({
1123-
oauth: {
1121+
const pd = createBackendClient({
1122+
credentials: {
11241123
clientId: "your-oauth-client-id",
11251124
clientSecret: "your-oauth-client-secret",
11261125
}
@@ -1133,10 +1132,10 @@ console.log("All accounts associated with the external ID have been deleted.");
11331132
</Tabs.Tab>
11341133
<Tabs.Tab>
11351134
```javascript
1136-
import { createClient } from "@pipedream/sdk";
1135+
import { createBackendClient } from "@pipedream/sdk";
11371136

1138-
const pd = createClient({
1139-
oauth: {
1137+
const pd = createBackendClient({
1138+
credentials: {
11401139
clientId: "your-oauth-client-id",
11411140
clientSecret: "your-oauth-client-secret",
11421141
}
@@ -1193,10 +1192,10 @@ GET /{project_id}/info
11931192
<Tabs items={['TypeScript', 'Node.js', 'HTTP (cURL)']}>
11941193
<Tabs.Tab>
11951194
```typescript
1196-
import { createClient } from "@pipedream/sdk";
1195+
import { createBackendClient } from "@pipedream/sdk";
11971196

1198-
const pd = createClient({
1199-
oauth: {
1197+
const pd = createBackendClient({
1198+
credentials: {
12001199
clientId: "your-oauth-client-id",
12011200
clientSecret: "your-oauth-client-secret",
12021201
}
@@ -1209,10 +1208,10 @@ const info = await pd.getProjectInfo({
12091208
</Tabs.Tab>
12101209
<Tabs.Tab>
12111210
```javascript
1212-
import { createClient } from "@pipedream/sdk";
1211+
import { createBackendClient } from "@pipedream/sdk";
12131212

1214-
const pd = createClient({
1215-
oauth: {
1213+
const pd = createBackendClient({
1214+
credentials: {
12161215
clientId: "your-oauth-client-id",
12171216
clientSecret: "your-oauth-client-secret",
12181217
}

docs-v2/pages/connect/quickstart.mdx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,10 @@ In our example, `app/page.tsx` calls the `connectAccount` method from the Pipedr
118118
<Image src="https://res.cloudinary.com/pipedreamin/image/upload/v1724182571/connect-account-button-screenshot_n7vjvq.png" alt="Connect your account button" width={550} height={300} />
119119

120120
```typescript
121-
// Note that we import the browser-specific SDK client here
122-
import { createClient } from "@pipedream/sdk/browser"
121+
import { createFrontendClient } from "@pipedream/sdk"
123122

124123
export default function Home() {
125-
const pd = createClient()
124+
const pd = createFrontendClient()
126125
function connectAccount() {
127126
pd.connectAccount({
128127
app: appSlug, // Pass the app name slug of the app you want to integrate
@@ -170,17 +169,17 @@ This example shows you how to fetch credentials by your end user's `external_id`
170169
<Tabs.Tab>
171170
```typescript
172171
import {
173-
createClient,
172+
createBackendClient,
174173
} from "@pipedream/sdk";
175174

176-
const pd = createClient({
177-
oauth: {
175+
const pd = createBackendClient({
176+
credentials: {
178177
clientId: "your-oauth-client-id",
179178
clientSecret: "your-oauth-client-secret",
180179
}
181180
});
182181

183-
export async function getUserAccounts(externalId: string, include_credentials: number = 0) {
182+
export async function getUserAccounts(externalId: string, include_credentials: boolean = false) {
184183
await pd.getAccountsByExternalId(externalId, {
185184
include_credentials, // set to 1 to include credentials
186185
})

0 commit comments

Comments
 (0)