@@ -7,6 +7,10 @@ import {
77 ClientCredentials ,
88} from "simple-oauth2" ;
99
10+ /**
11+ * OAuth credentials for your Pipedream account, containing client ID and
12+ * secret.
13+ */
1014export type OAuthCredentials = {
1115 clientId : string ;
1216 clientSecret : string ;
@@ -24,7 +28,7 @@ export type BackendClientOpts = {
2428 environment ?: string ;
2529
2630 /**
27- * Your OAuth credentials, containing client ID and secret .
31+ * The credentials to use for authentication against the Pipedream API .
2832 */
2933 credentials : OAuthCredentials ;
3034
@@ -75,13 +79,14 @@ export type ConnectTokenOpts = {
7579 error_redirect_uri ?: string ;
7680
7781 /**
78- * An optional webhook uri that Pipedream can invoke on success or failure of connection requests.
82+ * An optional webhook uri that Pipedream can invoke on success or failure of
83+ * connection requests.
7984 */
8085 webhook_uri ?: string ;
8186
8287 /**
83- * Specify the environment (' production' or ' development' ) to use for the account connection flow.
84- * Defaults to ' production' .
88+ * Specify the environment (" production" or " development" ) to use for the
89+ * account connection flow. Defaults to " production" .
8590 */
8691 environment_name ?: string ;
8792} ;
@@ -93,13 +98,14 @@ export type AppInfo = {
9398 id ?: string ;
9499
95100 /**
96- * https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug
101+ * The name slug of the target app (see
102+ * https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)
97103 */
98104 name_slug : string ;
99105} ;
100106
101107/**
102- * Response received after requesting project info.
108+ * Response received after requesting a project's info.
103109 */
104110export type ProjectInfoResponse = {
105111 /**
@@ -129,7 +135,7 @@ export type ConnectTokenResponse = {
129135} ;
130136
131137/**
132- * The authentication type for the app .
138+ * The types of authentication that Pipedream apps support .
133139 */
134140export enum AppAuthType {
135141 OAuth = "oauth" ,
@@ -138,7 +144,7 @@ export enum AppAuthType {
138144}
139145
140146/**
141- * Response object for Pipedream app metadata
147+ * Response object for a Pipedream app's metadata
142148 */
143149export type AppResponse = AppInfo & {
144150 /**
@@ -215,7 +221,8 @@ export type Account = {
215221 external_id : string ;
216222
217223 /**
218- * Indicates if the account is healthy. Pipedream will periodically retry token refresh and test requests for unhealthy accounts.
224+ * Indicates if the account is healthy. Pipedream will periodically retry
225+ * token refresh and test requests for unhealthy accounts.
219226 */
220227 healthy : boolean ;
221228
@@ -235,12 +242,14 @@ export type Account = {
235242 created_at : string ;
236243
237244 /**
238- * The date and time the account was last updated, an ISO 8601 formatted string.
245+ * The date and time the account was last updated, an ISO 8601 formatted
246+ * string.
239247 */
240248 updated_at : string ;
241249
242250 /**
243- * The credentials associated with the account, if include_credentials was true.
251+ * The credentials associated with the account, if the `include_credentials`
252+ * parameter was set to true in the request.
244253 */
245254 credentials ?: Record < string , string > ;
246255} ;
@@ -321,12 +330,8 @@ export class BackendClient {
321330 * Constructs a new BackendClient instance.
322331 *
323332 * @param opts - The options for configuring the server client.
324- * @param oauthClient - An optional OAuth client to use for authentication in
325- * tests
326333 */
327- constructor (
328- opts : BackendClientOpts ,
329- ) {
334+ constructor ( opts : BackendClientOpts ) {
330335 this . environment = opts . environment ?? "production" ;
331336 this . projectId = opts . projectId ;
332337
@@ -520,14 +525,13 @@ export class BackendClient {
520525 }
521526
522527 /**
523- * Creates a new Pipedream Connect token.
524- * See https://pipedream.com/docs/connect/quickstart#connect-to-the-pipedream-api-from-your-server-and-create-a-token
528+ * Creates a new Pipedream Connect token. See
529+ * https://pipedream.com/docs/connect/quickstart#connect-to-the-pipedream-api-from-your-server-and-create-a-token
525530 *
526531 * @param opts - The options for creating the connect token.
527532 * @returns A promise resolving to the connect token response.
528533 *
529534 * @example
530- *
531535 * ```typescript
532536 * const tokenResponse = await client.createConnectToken({
533537 * external_user_id: "external-user-id",
@@ -549,10 +553,10 @@ export class BackendClient {
549553 /**
550554 * Retrieves the list of accounts associated with the project.
551555 *
556+ * @param params - The query parameters for retrieving accounts.
552557 * @returns A promise resolving to a list of accounts.
553558 *
554559 * @example
555- *
556560 * ```typescript
557561 * const accounts = await client.getAccounts({ include_credentials: 1 });
558562 * console.log(accounts);
@@ -572,19 +576,14 @@ export class BackendClient {
572576 * @returns A promise resolving to the account.
573577 *
574578 * @example
575- *
576579 * ```typescript
577580 * const account = await client.getAccountById("account-id");
578581 * console.log(account);
579582 * ```
580583 */
581- public getAccountById (
582- accountId : string ,
583- params : GetAccountOpts = { } ,
584- ) : Promise < Account > {
584+ public getAccountById ( accountId : string ) : Promise < Account > {
585585 return this . makeConnectRequest ( `/accounts/${ accountId } ` , {
586586 method : "GET" ,
587- params,
588587 } ) ;
589588 }
590589
@@ -595,7 +594,6 @@ export class BackendClient {
595594 * @returns A promise resolving when the account is deleted.
596595 *
597596 * @example
598- *
599597 * ```typescript
600598 * await client.deleteAccount("account-id");
601599 * console.log("Account deleted");
@@ -614,7 +612,6 @@ export class BackendClient {
614612 * @returns A promise resolving when all accounts are deleted.
615613 *
616614 * @example
617- *
618615 * ```typescript
619616 * await client.deleteAccountsByApp("app-id");
620617 * console.log("All accounts deleted");
@@ -633,7 +630,6 @@ export class BackendClient {
633630 * @returns A promise resolving when all accounts are deleted.
634631 *
635632 * @example
636- *
637633 * ```typescript
638634 * await client.deleteExternalUser("external-id");
639635 * console.log("All accounts deleted");
@@ -663,35 +659,35 @@ export class BackendClient {
663659 }
664660
665661 /**
666- * Builds a full workflow URL based on the input.
667- *
668- * @param input - Either a full URL (with or without protocol) or just an endpoint ID.
669- *
670- * @returns The fully constructed URL.
671- *
672- * @throws If the input is a malformed URL, throws an error with a clear message.
673- *
674- * @example
675- * ```typescript
676- * // Full URL input
677- * this.buildWorkflowUrl("https://en123.m.pipedream.net");
678- * // Returns: "https://en123.m.pipedream.net"
679- * ```
680- *
681- * @example
682- * ```typescript
683- * // Partial URL (without protocol)
684- * this.buildWorkflowUrl("en123.m.pipedream.net");
685- * // Returns: "https://en123.m.pipedream.net"
686- * ```
687- *
688- * @example
689- * ```typescript
690- * // ID only input
691- * this.buildWorkflowUrl("en123");
692- * // Returns: "https://en123.yourdomain.com" (where `yourdomain.com` is set in `workflowDomain`)
693- * ```
694- */
662+ * Builds a full workflow URL based on the input.
663+ *
664+ * @param input - Either a full URL (with or without protocol) or just an
665+ * endpoint ID.
666+ * @returns The fully constructed URL.
667+ * @throws If the input is a malformed URL, throws an error with a clear
668+ * message.
669+ *
670+ * @example
671+ * ```typescript
672+ * // Full URL input
673+ * this.buildWorkflowUrl("https://en123.m.pipedream.net");
674+ * // Returns: "https://en123.m.pipedream.net"
675+ * ```
676+ *
677+ * @example
678+ * ```typescript
679+ * // Partial URL (without protocol)
680+ * this.buildWorkflowUrl("en123.m.pipedream.net");
681+ * // Returns: "https://en123.m.pipedream.net"
682+ * ```
683+ *
684+ * @example
685+ * ```typescript
686+ * // ID only input
687+ * this.buildWorkflowUrl("en123");
688+ * // Returns: "https://en123.yourdomain.com" (where `yourdomain.com` is set in `workflowDomain`)
689+ * ```
690+ */
695691 private buildWorkflowUrl ( input : string ) : string {
696692 let url : string ;
697693
@@ -727,11 +723,9 @@ export class BackendClient {
727723 * Authorization header will always be set with an OAuth access token
728724 * retrieved by the client.
729725 * @param authType - The type of authorization to use for the request.
730- *
731726 * @returns A promise resolving to the response from the workflow.
732727 *
733728 * @example
734- *
735729 * ```typescript
736730 * const response = await client.invokeWorkflow(
737731 * "https://your-workflow-url.m.pipedream.net",
@@ -802,11 +796,9 @@ export class BackendClient {
802796 * @param opts.headers - The headers to include in the request. Note that the
803797 * Authorization header will always be set with an OAuth access token
804798 * retrieved by the client.
805- *
806799 * @returns A promise resolving to the response from the workflow.
807800 *
808801 * @example
809- *
810802 *```typescript
811803 *const response = await client.invokeWorkflowForExternalUser(
812804 * "https://your-workflow-url.m.pipedream.net",
0 commit comments