diff --git a/.fernignore b/.fernignore index 261dfc3..e9f73aa 100644 --- a/.fernignore +++ b/.fernignore @@ -18,11 +18,21 @@ reference.md MIGRATE.md # Custom Pipedream client files +src/api/resources/index.ts +src/api/types/index.ts +src/browser/index.ts +src/index.ts +src/wrapper # Ideally, we shouldn't. But until Fern supports the changes that we've made we # have to override some parts. +src/Client.ts # Custom auth files +src/core/auth/index.ts +src/core/auth/ConnectTokenProvider.ts +src/core/auth/StaticTokenProvider.ts +src/core/auth/TokenProvider.ts # Custom configuration props files src/api/types/ConfiguredProps.ts @@ -45,3 +55,4 @@ src/api/resources/workflows/client/requests/InvokeWorkflowOpts.ts src/api/resources/workflows/client/Client.ts src/api/resources/workflows/client/index.ts src/api/resources/workflows/index.ts +src/api/types/HTTPAuthType.ts diff --git a/package.json b/package.json index fd1f118..7c23760 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/sdk", - "version": "2.3.2", + "version": "2.3.3", "private": false, "repository": "github:PipedreamHQ/pipedream-sdk-typescript", "type": "commonjs", diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts new file mode 100644 index 0000000..d7a5556 --- /dev/null +++ b/src/api/errors/BadRequestError.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as core from "../../core/index.js"; +import * as errors from "../../errors/index.js"; + +export class BadRequestError extends errors.PipedreamError { + constructor(body?: unknown, rawResponse?: core.RawResponse) { + super({ + message: "BadRequestError", + statusCode: 400, + body: body, + rawResponse: rawResponse, + }); + Object.setPrototypeOf(this, BadRequestError.prototype); + } +} diff --git a/src/api/errors/NotFoundError.ts b/src/api/errors/NotFoundError.ts new file mode 100644 index 0000000..c83739d --- /dev/null +++ b/src/api/errors/NotFoundError.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as core from "../../core/index.js"; +import * as errors from "../../errors/index.js"; + +export class NotFoundError extends errors.PipedreamError { + constructor(body?: unknown, rawResponse?: core.RawResponse) { + super({ + message: "NotFoundError", + statusCode: 404, + body: body, + rawResponse: rawResponse, + }); + Object.setPrototypeOf(this, NotFoundError.prototype); + } +} diff --git a/src/api/errors/index.ts b/src/api/errors/index.ts index 06b0452..e6e1fe8 100644 --- a/src/api/errors/index.ts +++ b/src/api/errors/index.ts @@ -1 +1,3 @@ +export * from "./BadRequestError.js"; +export * from "./NotFoundError.js"; export * from "./TooManyRequestsError.js"; diff --git a/src/api/resources/accounts/client/Client.ts b/src/api/resources/accounts/client/Client.ts index 5020985..7958a1a 100644 --- a/src/api/resources/accounts/client/Client.ts +++ b/src/api/resources/accounts/client/Client.ts @@ -10,7 +10,7 @@ import * as Pipedream from "../../../index.js"; export declare namespace Accounts { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} diff --git a/src/api/resources/actions/client/Client.ts b/src/api/resources/actions/client/Client.ts index bd6bbe8..44cc41a 100644 --- a/src/api/resources/actions/client/Client.ts +++ b/src/api/resources/actions/client/Client.ts @@ -10,7 +10,7 @@ import * as Pipedream from "../../../index.js"; export declare namespace Actions { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} @@ -29,6 +29,7 @@ export class Actions { * @param {Pipedream.ActionsListRequest} request * @param {Actions.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link Pipedream.BadRequestError} * @throws {@link Pipedream.TooManyRequestsError} * * @example @@ -108,6 +109,8 @@ export class Actions { } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { + case 400: + throw new Pipedream.BadRequestError(_response.error.body, _response.rawResponse); case 429: throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse); default: diff --git a/src/api/resources/appCategories/client/Client.ts b/src/api/resources/appCategories/client/Client.ts index c7db14c..7102fe2 100644 --- a/src/api/resources/appCategories/client/Client.ts +++ b/src/api/resources/appCategories/client/Client.ts @@ -10,7 +10,7 @@ import type * as Pipedream from "../../../index.js"; export declare namespace AppCategories { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} diff --git a/src/api/resources/apps/client/Client.ts b/src/api/resources/apps/client/Client.ts index 2598a5f..3877f49 100644 --- a/src/api/resources/apps/client/Client.ts +++ b/src/api/resources/apps/client/Client.ts @@ -10,7 +10,7 @@ import type * as Pipedream from "../../../index.js"; export declare namespace Apps { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} diff --git a/src/api/resources/components/client/Client.ts b/src/api/resources/components/client/Client.ts index d29f658..cdb2a4f 100644 --- a/src/api/resources/components/client/Client.ts +++ b/src/api/resources/components/client/Client.ts @@ -10,7 +10,7 @@ import * as Pipedream from "../../../index.js"; export declare namespace Components { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} @@ -29,6 +29,7 @@ export class Components { * @param {Pipedream.ComponentsListRequest} request * @param {Components.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link Pipedream.BadRequestError} * @throws {@link Pipedream.TooManyRequestsError} * * @example @@ -115,6 +116,8 @@ export class Components { } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { + case 400: + throw new Pipedream.BadRequestError(_response.error.body, _response.rawResponse); case 429: throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse); default: diff --git a/src/api/resources/deployedTriggers/client/Client.ts b/src/api/resources/deployedTriggers/client/Client.ts index dd2e0be..3590e65 100644 --- a/src/api/resources/deployedTriggers/client/Client.ts +++ b/src/api/resources/deployedTriggers/client/Client.ts @@ -10,7 +10,7 @@ import * as Pipedream from "../../../index.js"; export declare namespace DeployedTriggers { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} diff --git a/src/api/resources/fileStash/client/Client.ts b/src/api/resources/fileStash/client/Client.ts index 6031153..5cf95d4 100644 --- a/src/api/resources/fileStash/client/Client.ts +++ b/src/api/resources/fileStash/client/Client.ts @@ -9,7 +9,7 @@ import * as Pipedream from "../../../index.js"; export declare namespace FileStash { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 4c55785..c9bfa5f 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,29 +1,30 @@ +export * from "./accounts/client/requests/index.js"; +export * as accounts from "./accounts/index.js"; +export * from "./actions/client/requests/index.js"; +export * as actions from "./actions/index.js"; +export * from "./actions/types/index.js"; +export * as appCategories from "./appCategories/index.js"; +export * from "./apps/client/requests/index.js"; export * as apps from "./apps/index.js"; export * from "./apps/types/index.js"; -export * as appCategories from "./appCategories/index.js"; -export * as accounts from "./accounts/index.js"; -export * as users from "./users/index.js"; +export * from "./components/client/requests/index.js"; export * as components from "./components/index.js"; export * from "./components/types/index.js"; -export * as actions from "./actions/index.js"; -export * from "./actions/types/index.js"; -export * as triggers from "./triggers/index.js"; -export * from "./triggers/types/index.js"; +export * from "./deployedTriggers/client/requests/index.js"; export * as deployedTriggers from "./deployedTriggers/index.js"; +export * from "./fileStash/client/requests/index.js"; export * as fileStash from "./fileStash/index.js"; +export * from "./oauthTokens/client/requests/index.js"; +export * as oauthTokens from "./oauthTokens/index.js"; +export * from "./projects/client/requests/index.js"; export * as projects from "./projects/index.js"; +export * from "./proxy/client/requests/index.js"; export * as proxy from "./proxy/index.js"; +export * from "./tokens/client/requests/index.js"; export * as tokens from "./tokens/index.js"; -export * as oauthTokens from "./oauthTokens/index.js"; -export * as workflows from "./workflows/index.js"; -export * from "./apps/client/requests/index.js"; -export * from "./accounts/client/requests/index.js"; -export * from "./components/client/requests/index.js"; -export * from "./actions/client/requests/index.js"; export * from "./triggers/client/requests/index.js"; -export * from "./deployedTriggers/client/requests/index.js"; -export * from "./fileStash/client/requests/index.js"; -export * from "./proxy/client/requests/index.js"; -export * from "./tokens/client/requests/index.js"; -export * from "./oauthTokens/client/requests/index.js"; +export * as triggers from "./triggers/index.js"; +export * from "./triggers/types/index.js"; +export * as users from "./users/index.js"; +export * as workflows from "./workflows/index.js"; export * from "./workflows/client/requests/index.js"; diff --git a/src/api/resources/oauthTokens/client/Client.ts b/src/api/resources/oauthTokens/client/Client.ts index 34bfef5..3775bc0 100644 --- a/src/api/resources/oauthTokens/client/Client.ts +++ b/src/api/resources/oauthTokens/client/Client.ts @@ -10,7 +10,7 @@ import type * as Pipedream from "../../../index.js"; export declare namespace OauthTokens { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} diff --git a/src/api/resources/projects/client/Client.ts b/src/api/resources/projects/client/Client.ts index 0e68abc..ade501e 100644 --- a/src/api/resources/projects/client/Client.ts +++ b/src/api/resources/projects/client/Client.ts @@ -10,7 +10,7 @@ import * as Pipedream from "../../../index.js"; export declare namespace Projects { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} @@ -23,6 +23,579 @@ export class Projects { this._options = _options; } + /** + * List the projects that are available to the authenticated Connect client + * + * @param {Pipedream.ProjectsListRequest} request + * @param {Projects.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Pipedream.NotFoundError} + * @throws {@link Pipedream.TooManyRequestsError} + * + * @example + * await client.projects.list({ + * after: "after", + * before: "before", + * limit: 1, + * q: "q" + * }) + */ + public async list( + request: Pipedream.ProjectsListRequest = {}, + requestOptions?: Projects.RequestOptions, + ): Promise> { + const list = core.HttpResponsePromise.interceptFunction( + async ( + request: Pipedream.ProjectsListRequest, + ): Promise> => { + const { after, before, limit, q } = request; + const _queryParams: Record = {}; + if (after != null) { + _queryParams.after = after; + } + if (before != null) { + _queryParams.before = before; + } + if (limit != null) { + _queryParams.limit = limit.toString(); + } + if (q != null) { + _queryParams.q = q; + } + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "x-pd-environment": requestOptions?.projectEnvironment ?? this._options?.projectEnvironment, + }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.PipedreamEnvironment.Prod, + "v1/connect/projects", + ), + method: "GET", + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.ListProjectsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Pipedream.NotFoundError(_response.error.body, _response.rawResponse); + case 429: + throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse); + default: + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + switch (_response.error.reason) { + case "non-json": + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.PipedreamTimeoutError( + "Timeout exceeded when calling GET /v1/connect/projects.", + ); + case "unknown": + throw new errors.PipedreamError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + }, + ); + const dataWithRawResponse = await list(request).withRawResponse(); + return new core.Pageable({ + response: dataWithRawResponse.data, + rawResponse: dataWithRawResponse.rawResponse, + hasNextPage: (response) => + response?.pageInfo.endCursor != null && + !(typeof response?.pageInfo.endCursor === "string" && response?.pageInfo.endCursor === ""), + getItems: (response) => response?.data ?? [], + loadPage: (response) => { + return list(core.setObjectProperty(request, "after", response?.pageInfo.endCursor)); + }, + }); + } + + /** + * Create a new project for the authenticated workspace + * + * @param {Pipedream.CreateProjectOpts} request + * @param {Projects.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Pipedream.TooManyRequestsError} + * + * @example + * await client.projects.create({ + * name: "name" + * }) + */ + public create( + request: Pipedream.CreateProjectOpts, + requestOptions?: Projects.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); + } + + private async __create( + request: Pipedream.CreateProjectOpts, + requestOptions?: Projects.RequestOptions, + ): Promise> { + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "x-pd-environment": requestOptions?.projectEnvironment ?? this._options?.projectEnvironment, + }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.PipedreamEnvironment.Prod, + "v1/connect/projects", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.CreateProjectOpts.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.Project.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 429: + throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse); + default: + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.PipedreamTimeoutError("Timeout exceeded when calling POST /v1/connect/projects."); + case "unknown": + throw new errors.PipedreamError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Get the project details for a specific project + * + * @param {string} projectId - The project ID, which starts with `proj_`. + * @param {Projects.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Pipedream.TooManyRequestsError} + * + * @example + * await client.projects.retrieve("project_id") + */ + public retrieve( + projectId: string, + requestOptions?: Projects.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieve(projectId, requestOptions)); + } + + private async __retrieve( + projectId: string, + requestOptions?: Projects.RequestOptions, + ): Promise> { + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "x-pd-environment": requestOptions?.projectEnvironment ?? this._options?.projectEnvironment, + }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.PipedreamEnvironment.Prod, + `v1/connect/projects/${core.url.encodePathParam(projectId)}`, + ), + method: "GET", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.Project.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 429: + throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse); + default: + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.PipedreamTimeoutError( + "Timeout exceeded when calling GET /v1/connect/projects/{project_id}.", + ); + case "unknown": + throw new errors.PipedreamError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Delete a project owned by the authenticated workspace + * + * @param {string} projectId - The project ID, which starts with `proj_`. + * @param {Projects.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Pipedream.TooManyRequestsError} + * + * @example + * await client.projects.delete("project_id") + */ + public delete(projectId: string, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__delete(projectId, requestOptions)); + } + + private async __delete( + projectId: string, + requestOptions?: Projects.RequestOptions, + ): Promise> { + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "x-pd-environment": requestOptions?.projectEnvironment ?? this._options?.projectEnvironment, + }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.PipedreamEnvironment.Prod, + `v1/connect/projects/${core.url.encodePathParam(projectId)}`, + ), + method: "DELETE", + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 429: + throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse); + default: + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.PipedreamTimeoutError( + "Timeout exceeded when calling DELETE /v1/connect/projects/{project_id}.", + ); + case "unknown": + throw new errors.PipedreamError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Update project details or application information + * + * @param {string} projectId - The project ID, which starts with `proj_`. + * @param {Pipedream.UpdateProjectOpts} request + * @param {Projects.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Pipedream.TooManyRequestsError} + * + * @example + * await client.projects.update("project_id") + */ + public update( + projectId: string, + request: Pipedream.UpdateProjectOpts = {}, + requestOptions?: Projects.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__update(projectId, request, requestOptions)); + } + + private async __update( + projectId: string, + request: Pipedream.UpdateProjectOpts = {}, + requestOptions?: Projects.RequestOptions, + ): Promise> { + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "x-pd-environment": requestOptions?.projectEnvironment ?? this._options?.projectEnvironment, + }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.PipedreamEnvironment.Prod, + `v1/connect/projects/${core.url.encodePathParam(projectId)}`, + ), + method: "PATCH", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.UpdateProjectOpts.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: serializers.Project.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 429: + throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse); + default: + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.PipedreamTimeoutError( + "Timeout exceeded when calling PATCH /v1/connect/projects/{project_id}.", + ); + case "unknown": + throw new errors.PipedreamError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Upload or replace the project logo + * + * @param {string} projectId - The project ID, which starts with `proj_`. + * @param {Pipedream.UpdateProjectLogoOpts} request + * @param {Projects.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Pipedream.BadRequestError} + * @throws {@link Pipedream.TooManyRequestsError} + * + * @example + * await client.projects.updateLogo("project_id", { + * logo: "data:image/png;base64,AAAAAA..." + * }) + */ + public updateLogo( + projectId: string, + request: Pipedream.UpdateProjectLogoOpts, + requestOptions?: Projects.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateLogo(projectId, request, requestOptions)); + } + + private async __updateLogo( + projectId: string, + request: Pipedream.UpdateProjectLogoOpts, + requestOptions?: Projects.RequestOptions, + ): Promise> { + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + this._options?.headers, + mergeOnlyDefinedHeaders({ + Authorization: await this._getAuthorizationHeader(), + "x-pd-environment": requestOptions?.projectEnvironment ?? this._options?.projectEnvironment, + }), + requestOptions?.headers, + ); + const _response = await core.fetcher({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.PipedreamEnvironment.Prod, + `v1/connect/projects/${core.url.encodePathParam(projectId)}/logo`, + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.UpdateProjectLogoOpts.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + omitUndefined: true, + }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Pipedream.BadRequestError(_response.error.body, _response.rawResponse); + case 429: + throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse); + default: + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.PipedreamError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.PipedreamTimeoutError( + "Timeout exceeded when calling POST /v1/connect/projects/{project_id}/logo.", + ); + case "unknown": + throw new errors.PipedreamError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + /** * Retrieve project configuration and environment details * diff --git a/src/api/resources/projects/client/index.ts b/src/api/resources/projects/client/index.ts index cb0ff5c..195f9aa 100644 --- a/src/api/resources/projects/client/index.ts +++ b/src/api/resources/projects/client/index.ts @@ -1 +1 @@ -export {}; +export * from "./requests/index.js"; diff --git a/src/api/resources/projects/client/requests/CreateProjectOpts.ts b/src/api/resources/projects/client/requests/CreateProjectOpts.ts new file mode 100644 index 0000000..7499c3b --- /dev/null +++ b/src/api/resources/projects/client/requests/CreateProjectOpts.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * name: "name" + * } + */ +export interface CreateProjectOpts { + /** Name of the project */ + name: string; + /** Display name for the Connect application */ + appName?: string; + /** Support email displayed to end users */ + supportEmail?: string; +} diff --git a/src/api/resources/projects/client/requests/ProjectsListRequest.ts b/src/api/resources/projects/client/requests/ProjectsListRequest.ts new file mode 100644 index 0000000..a61bc3f --- /dev/null +++ b/src/api/resources/projects/client/requests/ProjectsListRequest.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * after: "after", + * before: "before", + * limit: 1, + * q: "q" + * } + */ +export interface ProjectsListRequest { + /** The cursor to start from for pagination */ + after?: string; + /** The cursor to end before for pagination */ + before?: string; + /** The maximum number of results to return */ + limit?: number; + /** A search query to filter the projects */ + q?: string; +} diff --git a/src/api/resources/projects/client/requests/UpdateProjectLogoOpts.ts b/src/api/resources/projects/client/requests/UpdateProjectLogoOpts.ts new file mode 100644 index 0000000..afab4e0 --- /dev/null +++ b/src/api/resources/projects/client/requests/UpdateProjectLogoOpts.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * logo: "data:image/png;base64,AAAAAA..." + * } + */ +export interface UpdateProjectLogoOpts { + /** Data URI containing the new Base64 encoded image */ + logo: string; +} diff --git a/src/api/resources/projects/client/requests/UpdateProjectOpts.ts b/src/api/resources/projects/client/requests/UpdateProjectOpts.ts new file mode 100644 index 0000000..5a5ba1e --- /dev/null +++ b/src/api/resources/projects/client/requests/UpdateProjectOpts.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * {} + */ +export interface UpdateProjectOpts { + /** Name of the project */ + name?: string; + /** Display name for the Connect application */ + appName?: string; + /** Support email displayed to end users */ + supportEmail?: string; +} diff --git a/src/api/resources/projects/client/requests/index.ts b/src/api/resources/projects/client/requests/index.ts new file mode 100644 index 0000000..523a354 --- /dev/null +++ b/src/api/resources/projects/client/requests/index.ts @@ -0,0 +1,4 @@ +export type { CreateProjectOpts } from "./CreateProjectOpts.js"; +export type { ProjectsListRequest } from "./ProjectsListRequest.js"; +export type { UpdateProjectLogoOpts } from "./UpdateProjectLogoOpts.js"; +export type { UpdateProjectOpts } from "./UpdateProjectOpts.js"; diff --git a/src/api/resources/tokens/client/Client.ts b/src/api/resources/tokens/client/Client.ts index 1515718..c6cf133 100644 --- a/src/api/resources/tokens/client/Client.ts +++ b/src/api/resources/tokens/client/Client.ts @@ -10,7 +10,7 @@ import * as Pipedream from "../../../index.js"; export declare namespace Tokens { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} diff --git a/src/api/resources/triggers/client/Client.ts b/src/api/resources/triggers/client/Client.ts index eccecd9..2826439 100644 --- a/src/api/resources/triggers/client/Client.ts +++ b/src/api/resources/triggers/client/Client.ts @@ -10,7 +10,7 @@ import * as Pipedream from "../../../index.js"; export declare namespace Triggers { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} @@ -29,6 +29,7 @@ export class Triggers { * @param {Pipedream.TriggersListRequest} request * @param {Triggers.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link Pipedream.BadRequestError} * @throws {@link Pipedream.TooManyRequestsError} * * @example @@ -108,6 +109,8 @@ export class Triggers { } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { + case 400: + throw new Pipedream.BadRequestError(_response.error.body, _response.rawResponse); case 429: throw new Pipedream.TooManyRequestsError(_response.error.body, _response.rawResponse); default: diff --git a/src/api/resources/users/client/Client.ts b/src/api/resources/users/client/Client.ts index c4a16e0..3b1e5f4 100644 --- a/src/api/resources/users/client/Client.ts +++ b/src/api/resources/users/client/Client.ts @@ -9,7 +9,7 @@ import * as Pipedream from "../../../index.js"; export declare namespace Users { export interface Options extends BaseClientOptions { - token?: core.Supplier; + token?: core.Supplier; } export interface RequestOptions extends BaseRequestOptions {} diff --git a/src/api/types/ConfigurableProp.ts b/src/api/types/ConfigurableProp.ts index 9ace9cf..759d749 100644 --- a/src/api/types/ConfigurableProp.ts +++ b/src/api/types/ConfigurableProp.ts @@ -10,10 +10,13 @@ export type ConfigurableProp = | Pipedream.ConfigurableProp.Any | Pipedream.ConfigurableProp.App | Pipedream.ConfigurableProp.Boolean + | Pipedream.ConfigurableProp.DataStore + | Pipedream.ConfigurableProp.Dir | Pipedream.ConfigurableProp.InterfaceTimer | Pipedream.ConfigurableProp.InterfaceApphook | Pipedream.ConfigurableProp.IntegerArray | Pipedream.ConfigurableProp.InterfaceHttp + | Pipedream.ConfigurableProp.HttpRequest | Pipedream.ConfigurableProp.ServiceDb | Pipedream.ConfigurableProp.Sql | Pipedream.ConfigurableProp.AirtableBaseId @@ -23,7 +26,7 @@ export type ConfigurableProp = | Pipedream.ConfigurableProp.DiscordChannel | Pipedream.ConfigurableProp.DiscordChannelArray | Pipedream.ConfigurableProp.Integer - | Pipedream.ConfigurableProp.Object + | Pipedream.ConfigurableProp.Object_ | Pipedream.ConfigurableProp.String | Pipedream.ConfigurableProp.StringArray; @@ -44,6 +47,14 @@ export namespace ConfigurableProp { type: "boolean"; } + export interface DataStore extends Pipedream.ConfigurablePropDataStore { + type: "data_store"; + } + + export interface Dir extends Pipedream.ConfigurablePropDir { + type: "dir"; + } + export interface InterfaceTimer extends Pipedream.ConfigurablePropTimer { type: "$.interface.timer"; } @@ -60,6 +71,10 @@ export namespace ConfigurableProp { type: "$.interface.http"; } + export interface HttpRequest extends Pipedream.ConfigurablePropHttpRequest { + type: "http_request"; + } + export interface ServiceDb extends Pipedream.ConfigurablePropDb { type: "$.service.db"; } @@ -96,7 +111,7 @@ export namespace ConfigurableProp { type: "integer"; } - export interface Object extends Pipedream.ConfigurablePropObject { + export interface Object_ extends Pipedream.ConfigurablePropObject { type: "object"; } diff --git a/src/api/types/ConfigurablePropDataStore.ts b/src/api/types/ConfigurablePropDataStore.ts new file mode 100644 index 0000000..1e42ac9 --- /dev/null +++ b/src/api/types/ConfigurablePropDataStore.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../index.js"; + +export interface ConfigurablePropDataStore extends Pipedream.ConfigurablePropBase {} diff --git a/src/api/types/ConfigurablePropDir.ts b/src/api/types/ConfigurablePropDir.ts new file mode 100644 index 0000000..3a70520 --- /dev/null +++ b/src/api/types/ConfigurablePropDir.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../index.js"; + +export interface ConfigurablePropDir extends Pipedream.ConfigurablePropBase {} diff --git a/src/api/types/ConfigurablePropHttpRequest.ts b/src/api/types/ConfigurablePropHttpRequest.ts new file mode 100644 index 0000000..8622e48 --- /dev/null +++ b/src/api/types/ConfigurablePropHttpRequest.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../index.js"; + +export interface ConfigurablePropHttpRequest extends Pipedream.ConfigurablePropBase { + default?: Pipedream.HttpRequestConfig; +} diff --git a/src/api/types/ConfigurablePropType.ts b/src/api/types/ConfigurablePropType.ts deleted file mode 100644 index 0153c34..0000000 --- a/src/api/types/ConfigurablePropType.ts +++ /dev/null @@ -1,28 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -export const ConfigurablePropType = { - AirtableBaseId: "$.airtable.baseId", - AirtableFieldId: "$.airtable.fieldId", - AirtableTableId: "$.airtable.tableId", - AirtableViewId: "$.airtable.viewId", - DiscordChannel: "$.discord.channel", - DiscordChannelArray: "$.discord.channel[]", - InterfaceApphook: "$.interface.apphook", - InterfaceHttp: "$.interface.http", - InterfaceTimer: "$.interface.timer", - ServiceDb: "$.service.db", - Alert: "alert", - Any: "any", - App: "app", - Boolean: "boolean", - DataStore: "data_store", - Dir: "dir", - HttpRequest: "http_request", - Integer: "integer", - IntegerArray: "integer[]", - Object: "object", - Sql: "sql", - String: "string", - StringArray: "string[]", -} as const; -export type ConfigurablePropType = (typeof ConfigurablePropType)[keyof typeof ConfigurablePropType]; diff --git a/src/api/types/HttpRequestAuth.ts b/src/api/types/HttpRequestAuth.ts new file mode 100644 index 0000000..eeb8558 --- /dev/null +++ b/src/api/types/HttpRequestAuth.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../index.js"; + +/** + * Authentication configuration for HTTP request + */ +export interface HttpRequestAuth { + /** The authentication type */ + type?: Pipedream.HttpRequestAuthType; + username?: string; + password?: string; + token?: string; +} diff --git a/src/api/types/HttpRequestAuthType.ts b/src/api/types/HttpRequestAuthType.ts new file mode 100644 index 0000000..923fb6c --- /dev/null +++ b/src/api/types/HttpRequestAuthType.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +/** The authentication type */ +export const HttpRequestAuthType = { + Basic: "basic", + Bearer: "bearer", + None: "none", +} as const; +export type HttpRequestAuthType = (typeof HttpRequestAuthType)[keyof typeof HttpRequestAuthType]; diff --git a/src/api/types/HttpRequestBody.ts b/src/api/types/HttpRequestBody.ts new file mode 100644 index 0000000..1b8726d --- /dev/null +++ b/src/api/types/HttpRequestBody.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../index.js"; + +/** + * Body configuration for HTTP request + */ +export interface HttpRequestBody { + type?: Pipedream.HttpRequestBodyType; + contentType?: string; + fields?: Pipedream.HttpRequestField[]; + mode?: Pipedream.HttpRequestBodyMode; + raw?: string; +} diff --git a/src/api/types/HttpRequestBodyMode.ts b/src/api/types/HttpRequestBodyMode.ts new file mode 100644 index 0000000..062c738 --- /dev/null +++ b/src/api/types/HttpRequestBodyMode.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export const HttpRequestBodyMode = { + Fields: "fields", + Raw: "raw", +} as const; +export type HttpRequestBodyMode = (typeof HttpRequestBodyMode)[keyof typeof HttpRequestBodyMode]; diff --git a/src/api/types/HttpRequestBodyType.ts b/src/api/types/HttpRequestBodyType.ts new file mode 100644 index 0000000..2f97528 --- /dev/null +++ b/src/api/types/HttpRequestBodyType.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export const HttpRequestBodyType = { + Fields: "fields", + Raw: "raw", +} as const; +export type HttpRequestBodyType = (typeof HttpRequestBodyType)[keyof typeof HttpRequestBodyType]; diff --git a/src/api/types/HttpRequestConfig.ts b/src/api/types/HttpRequestConfig.ts new file mode 100644 index 0000000..775ac67 --- /dev/null +++ b/src/api/types/HttpRequestConfig.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../index.js"; + +/** + * Configuration for an HTTP request prop + */ +export interface HttpRequestConfig { + auth?: Pipedream.HttpRequestAuth; + body?: Pipedream.HttpRequestBody; + headers?: Pipedream.HttpRequestField[]; + params?: Pipedream.HttpRequestField[]; + tab?: string; + method?: string; + url?: string; +} diff --git a/src/api/types/HttpRequestField.ts b/src/api/types/HttpRequestField.ts new file mode 100644 index 0000000..e794273 --- /dev/null +++ b/src/api/types/HttpRequestField.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * A name-value field for HTTP request configuration + */ +export interface HttpRequestField { + /** The field name */ + name: string; + /** The field value */ + value: string; +} diff --git a/src/api/types/ListProjectsResponse.ts b/src/api/types/ListProjectsResponse.ts new file mode 100644 index 0000000..aa422dd --- /dev/null +++ b/src/api/types/ListProjectsResponse.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../index.js"; + +/** + * Response received when listing Connect projects + */ +export interface ListProjectsResponse { + data: Pipedream.Project[]; + pageInfo: Pipedream.PageInfo; +} diff --git a/src/api/types/Project.ts b/src/api/types/Project.ts new file mode 100644 index 0000000..5fc26df --- /dev/null +++ b/src/api/types/Project.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Project that can be accessed via the Connect API + */ +export interface Project { + /** Hash ID for the project */ + id: string; + /** Display name of the project */ + name: string; + /** App name shown to Connect users */ + appName?: string; + /** Support email configured for the project */ + supportEmail?: string; +} diff --git a/src/api/types/ProxyResponseBinary.ts b/src/api/types/ProxyResponseBinary.ts new file mode 100644 index 0000000..e9d59fa --- /dev/null +++ b/src/api/types/ProxyResponseBinary.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Binary response from the proxied API + */ +export type ProxyResponseBinary = string; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 985eaf3..ceebb86 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -9,7 +9,6 @@ export * from "./Component.js"; export * from "./ComponentStash.js"; export * from "./ComponentType.js"; export * from "./ConfigurableProp.js"; -export * from "./ConfigurablePropBase.js"; export * from "./ConfigurablePropAirtableBaseId.js"; export * from "./ConfigurablePropAirtableFieldId.js"; export * from "./ConfigurablePropAirtableTableId.js"; @@ -20,26 +19,30 @@ export * from "./ConfigurablePropAny.js"; export * from "./ConfigurablePropAnyOptionsItem.js"; export * from "./ConfigurablePropApp.js"; export * from "./ConfigurablePropApphook.js"; +export * from "./ConfigurablePropBase.js"; export * from "./ConfigurablePropBoolean.js"; export * from "./ConfigurablePropBooleanOptionsItem.js"; +export * from "./ConfigurablePropDataStore.js"; export * from "./ConfigurablePropDb.js"; +export * from "./ConfigurablePropDir.js"; export * from "./ConfigurablePropDiscord.js"; export * from "./ConfigurablePropDiscordChannel.js"; export * from "./ConfigurablePropDiscordChannelArray.js"; export * from "./ConfigurablePropHttp.js"; +export * from "./ConfigurablePropHttpRequest.js"; export * from "./ConfigurablePropInteger.js"; -export * from "./ConfigurablePropIntegerOptionsItem.js"; export * from "./ConfigurablePropIntegerArray.js"; export * from "./ConfigurablePropIntegerArrayOptionsItem.js"; +export * from "./ConfigurablePropIntegerOptionsItem.js"; export * from "./ConfigurablePropObject.js"; export * from "./ConfigurablePropObjectOptionsItem.js"; export * from "./ConfigurablePropSql.js"; export * from "./ConfigurablePropSqlAuth.js"; export * from "./ConfigurablePropSqlOptionsItem.js"; export * from "./ConfigurablePropString.js"; -export * from "./ConfigurablePropStringOptionsItem.js"; export * from "./ConfigurablePropStringArray.js"; export * from "./ConfigurablePropStringArrayOptionsItem.js"; +export * from "./ConfigurablePropStringOptionsItem.js"; export * from "./ConfigurablePropTimer.js"; export * from "./ConfigurablePropTimerDefault.js"; export * from "./ConfigurablePropTimerOption.js"; @@ -82,19 +85,29 @@ export * from "./GetTriggerWebhooksResponse.js"; export * from "./GetTriggerWorkflowsResponse.js"; export * from "./HTTPAuthType.js"; export * from "./HttpInterface.js"; +export * from "./HttpRequestAuth.js"; +export * from "./HttpRequestAuthType.js"; +export * from "./HttpRequestBody.js"; +export * from "./HttpRequestBodyMode.js"; +export * from "./HttpRequestBodyType.js"; +export * from "./HttpRequestConfig.js"; +export * from "./HttpRequestField.js"; export * from "./ListAccountsResponse.js"; export * from "./ListAppCategoriesResponse.js"; export * from "./ListAppsResponse.js"; +export * from "./ListProjectsResponse.js"; export * from "./Observation.js"; export * from "./ObservationError.js"; export * from "./PageInfo.js"; +export * from "./Project.js"; export * from "./ProjectEnvironment.js"; export * from "./ProjectInfoResponse.js"; export * from "./ProjectInfoResponseApp.js"; export * from "./PropOption.js"; -export * from "./PropOptionValue.js"; export * from "./PropOptionNested.js"; +export * from "./PropOptionValue.js"; export * from "./ProxyResponse.js"; +export * from "./ProxyResponseBinary.js"; export * from "./ReloadPropsOpts.js"; export * from "./ReloadPropsResponse.js"; export * from "./RunActionOptsStashId.js"; diff --git a/src/index.ts b/src/index.ts index 4a94d36..b06997c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,7 @@ export * from "./api/index.js"; -export { PipedreamError, PipedreamTimeoutError } from "./errors/index.js"; +export * as Pipedream from "./api/index.js"; +export type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js"; export { PipedreamEnvironment } from "./environments.js"; export { Pipedream as PipedreamClient, type PipedreamClientOpts } from "./wrapper/Pipedream.js"; +export { PipedreamError, PipedreamTimeoutError } from "./errors/index.js"; +export * as serialization from "./serialization/index.js"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index a9046bd..7de83b8 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -11,6 +11,8 @@ export * from "./deployedTriggers/client/requests/index.js"; export * as deployedTriggers from "./deployedTriggers/index.js"; export * from "./oauthTokens/client/requests/index.js"; export * as oauthTokens from "./oauthTokens/index.js"; +export * from "./projects/client/requests/index.js"; +export * as projects from "./projects/index.js"; export * as proxy from "./proxy/index.js"; export * from "./tokens/client/requests/index.js"; export * as tokens from "./tokens/index.js"; diff --git a/src/serialization/resources/projects/client/index.ts b/src/serialization/resources/projects/client/index.ts new file mode 100644 index 0000000..195f9aa --- /dev/null +++ b/src/serialization/resources/projects/client/index.ts @@ -0,0 +1 @@ +export * from "./requests/index.js"; diff --git a/src/serialization/resources/projects/client/requests/CreateProjectOpts.ts b/src/serialization/resources/projects/client/requests/CreateProjectOpts.ts new file mode 100644 index 0000000..82d09e8 --- /dev/null +++ b/src/serialization/resources/projects/client/requests/CreateProjectOpts.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../../../../api/index.js"; +import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; + +export const CreateProjectOpts: core.serialization.Schema< + serializers.CreateProjectOpts.Raw, + Pipedream.CreateProjectOpts +> = core.serialization.object({ + name: core.serialization.string(), + appName: core.serialization.property("app_name", core.serialization.string().optional()), + supportEmail: core.serialization.property("support_email", core.serialization.string().optional()), +}); + +export declare namespace CreateProjectOpts { + export interface Raw { + name: string; + app_name?: string | null; + support_email?: string | null; + } +} diff --git a/src/serialization/resources/projects/client/requests/UpdateProjectLogoOpts.ts b/src/serialization/resources/projects/client/requests/UpdateProjectLogoOpts.ts new file mode 100644 index 0000000..afdc37c --- /dev/null +++ b/src/serialization/resources/projects/client/requests/UpdateProjectLogoOpts.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../../../../api/index.js"; +import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; + +export const UpdateProjectLogoOpts: core.serialization.Schema< + serializers.UpdateProjectLogoOpts.Raw, + Pipedream.UpdateProjectLogoOpts +> = core.serialization.object({ + logo: core.serialization.string(), +}); + +export declare namespace UpdateProjectLogoOpts { + export interface Raw { + logo: string; + } +} diff --git a/src/serialization/resources/projects/client/requests/UpdateProjectOpts.ts b/src/serialization/resources/projects/client/requests/UpdateProjectOpts.ts new file mode 100644 index 0000000..5f3060d --- /dev/null +++ b/src/serialization/resources/projects/client/requests/UpdateProjectOpts.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../../../../api/index.js"; +import * as core from "../../../../../core/index.js"; +import type * as serializers from "../../../../index.js"; + +export const UpdateProjectOpts: core.serialization.Schema< + serializers.UpdateProjectOpts.Raw, + Pipedream.UpdateProjectOpts +> = core.serialization.object({ + name: core.serialization.string().optional(), + appName: core.serialization.property("app_name", core.serialization.string().optional()), + supportEmail: core.serialization.property("support_email", core.serialization.string().optional()), +}); + +export declare namespace UpdateProjectOpts { + export interface Raw { + name?: string | null; + app_name?: string | null; + support_email?: string | null; + } +} diff --git a/src/serialization/resources/projects/client/requests/index.ts b/src/serialization/resources/projects/client/requests/index.ts new file mode 100644 index 0000000..26cf1f9 --- /dev/null +++ b/src/serialization/resources/projects/client/requests/index.ts @@ -0,0 +1,3 @@ +export { CreateProjectOpts } from "./CreateProjectOpts.js"; +export { UpdateProjectLogoOpts } from "./UpdateProjectLogoOpts.js"; +export { UpdateProjectOpts } from "./UpdateProjectOpts.js"; diff --git a/src/serialization/resources/projects/index.ts b/src/serialization/resources/projects/index.ts new file mode 100644 index 0000000..914b8c3 --- /dev/null +++ b/src/serialization/resources/projects/index.ts @@ -0,0 +1 @@ +export * from "./client/index.js"; diff --git a/src/serialization/types/ConfigurableProp.ts b/src/serialization/types/ConfigurableProp.ts index 289256c..6ba1283 100644 --- a/src/serialization/types/ConfigurableProp.ts +++ b/src/serialization/types/ConfigurableProp.ts @@ -12,10 +12,13 @@ import { ConfigurablePropAny } from "./ConfigurablePropAny.js"; import { ConfigurablePropApp } from "./ConfigurablePropApp.js"; import { ConfigurablePropApphook } from "./ConfigurablePropApphook.js"; import { ConfigurablePropBoolean } from "./ConfigurablePropBoolean.js"; +import { ConfigurablePropDataStore } from "./ConfigurablePropDataStore.js"; import { ConfigurablePropDb } from "./ConfigurablePropDb.js"; +import { ConfigurablePropDir } from "./ConfigurablePropDir.js"; import { ConfigurablePropDiscordChannel } from "./ConfigurablePropDiscordChannel.js"; import { ConfigurablePropDiscordChannelArray } from "./ConfigurablePropDiscordChannelArray.js"; import { ConfigurablePropHttp } from "./ConfigurablePropHttp.js"; +import { ConfigurablePropHttpRequest } from "./ConfigurablePropHttpRequest.js"; import { ConfigurablePropInteger } from "./ConfigurablePropInteger.js"; import { ConfigurablePropIntegerArray } from "./ConfigurablePropIntegerArray.js"; import { ConfigurablePropObject } from "./ConfigurablePropObject.js"; @@ -31,10 +34,13 @@ export const ConfigurableProp: core.serialization.Schema = core.serialization.object({}).extend(ConfigurablePropBase); + +export declare namespace ConfigurablePropDataStore { + export interface Raw extends ConfigurablePropBase.Raw {} +} diff --git a/src/serialization/types/ConfigurablePropDir.ts b/src/serialization/types/ConfigurablePropDir.ts new file mode 100644 index 0000000..90238cb --- /dev/null +++ b/src/serialization/types/ConfigurablePropDir.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { ConfigurablePropBase } from "./ConfigurablePropBase.js"; + +export const ConfigurablePropDir: core.serialization.ObjectSchema< + serializers.ConfigurablePropDir.Raw, + Pipedream.ConfigurablePropDir +> = core.serialization.object({}).extend(ConfigurablePropBase); + +export declare namespace ConfigurablePropDir { + export interface Raw extends ConfigurablePropBase.Raw {} +} diff --git a/src/serialization/types/ConfigurablePropHttpRequest.ts b/src/serialization/types/ConfigurablePropHttpRequest.ts new file mode 100644 index 0000000..0ce0cec --- /dev/null +++ b/src/serialization/types/ConfigurablePropHttpRequest.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { ConfigurablePropBase } from "./ConfigurablePropBase.js"; +import { HttpRequestConfig } from "./HttpRequestConfig.js"; + +export const ConfigurablePropHttpRequest: core.serialization.ObjectSchema< + serializers.ConfigurablePropHttpRequest.Raw, + Pipedream.ConfigurablePropHttpRequest +> = core.serialization + .object({ + default: HttpRequestConfig.optional(), + }) + .extend(ConfigurablePropBase); + +export declare namespace ConfigurablePropHttpRequest { + export interface Raw extends ConfigurablePropBase.Raw { + default?: HttpRequestConfig.Raw | null; + } +} diff --git a/src/serialization/types/HttpRequestAuth.ts b/src/serialization/types/HttpRequestAuth.ts new file mode 100644 index 0000000..9152dc1 --- /dev/null +++ b/src/serialization/types/HttpRequestAuth.ts @@ -0,0 +1,25 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { HttpRequestAuthType } from "./HttpRequestAuthType.js"; + +export const HttpRequestAuth: core.serialization.ObjectSchema< + serializers.HttpRequestAuth.Raw, + Pipedream.HttpRequestAuth +> = core.serialization.object({ + type: HttpRequestAuthType.optional(), + username: core.serialization.string().optional(), + password: core.serialization.string().optional(), + token: core.serialization.string().optional(), +}); + +export declare namespace HttpRequestAuth { + export interface Raw { + type?: HttpRequestAuthType.Raw | null; + username?: string | null; + password?: string | null; + token?: string | null; + } +} diff --git a/src/serialization/types/HttpRequestAuthType.ts b/src/serialization/types/HttpRequestAuthType.ts new file mode 100644 index 0000000..776553c --- /dev/null +++ b/src/serialization/types/HttpRequestAuthType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const HttpRequestAuthType: core.serialization.Schema< + serializers.HttpRequestAuthType.Raw, + Pipedream.HttpRequestAuthType +> = core.serialization.enum_(["basic", "bearer", "none"]); + +export declare namespace HttpRequestAuthType { + export type Raw = "basic" | "bearer" | "none"; +} diff --git a/src/serialization/types/HttpRequestBody.ts b/src/serialization/types/HttpRequestBody.ts new file mode 100644 index 0000000..a87a7f4 --- /dev/null +++ b/src/serialization/types/HttpRequestBody.ts @@ -0,0 +1,29 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { HttpRequestBodyMode } from "./HttpRequestBodyMode.js"; +import { HttpRequestBodyType } from "./HttpRequestBodyType.js"; +import { HttpRequestField } from "./HttpRequestField.js"; + +export const HttpRequestBody: core.serialization.ObjectSchema< + serializers.HttpRequestBody.Raw, + Pipedream.HttpRequestBody +> = core.serialization.object({ + type: HttpRequestBodyType.optional(), + contentType: core.serialization.string().optional(), + fields: core.serialization.list(HttpRequestField).optional(), + mode: HttpRequestBodyMode.optional(), + raw: core.serialization.string().optional(), +}); + +export declare namespace HttpRequestBody { + export interface Raw { + type?: HttpRequestBodyType.Raw | null; + contentType?: string | null; + fields?: HttpRequestField.Raw[] | null; + mode?: HttpRequestBodyMode.Raw | null; + raw?: string | null; + } +} diff --git a/src/serialization/types/HttpRequestBodyMode.ts b/src/serialization/types/HttpRequestBodyMode.ts new file mode 100644 index 0000000..193d2b2 --- /dev/null +++ b/src/serialization/types/HttpRequestBodyMode.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const HttpRequestBodyMode: core.serialization.Schema< + serializers.HttpRequestBodyMode.Raw, + Pipedream.HttpRequestBodyMode +> = core.serialization.enum_(["fields", "raw"]); + +export declare namespace HttpRequestBodyMode { + export type Raw = "fields" | "raw"; +} diff --git a/src/serialization/types/HttpRequestBodyType.ts b/src/serialization/types/HttpRequestBodyType.ts new file mode 100644 index 0000000..5880ba8 --- /dev/null +++ b/src/serialization/types/HttpRequestBodyType.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const HttpRequestBodyType: core.serialization.Schema< + serializers.HttpRequestBodyType.Raw, + Pipedream.HttpRequestBodyType +> = core.serialization.enum_(["fields", "raw"]); + +export declare namespace HttpRequestBodyType { + export type Raw = "fields" | "raw"; +} diff --git a/src/serialization/types/HttpRequestConfig.ts b/src/serialization/types/HttpRequestConfig.ts new file mode 100644 index 0000000..3e6eefb --- /dev/null +++ b/src/serialization/types/HttpRequestConfig.ts @@ -0,0 +1,33 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { HttpRequestAuth } from "./HttpRequestAuth.js"; +import { HttpRequestBody } from "./HttpRequestBody.js"; +import { HttpRequestField } from "./HttpRequestField.js"; + +export const HttpRequestConfig: core.serialization.ObjectSchema< + serializers.HttpRequestConfig.Raw, + Pipedream.HttpRequestConfig +> = core.serialization.object({ + auth: HttpRequestAuth.optional(), + body: HttpRequestBody.optional(), + headers: core.serialization.list(HttpRequestField).optional(), + params: core.serialization.list(HttpRequestField).optional(), + tab: core.serialization.string().optional(), + method: core.serialization.string().optional(), + url: core.serialization.string().optional(), +}); + +export declare namespace HttpRequestConfig { + export interface Raw { + auth?: HttpRequestAuth.Raw | null; + body?: HttpRequestBody.Raw | null; + headers?: HttpRequestField.Raw[] | null; + params?: HttpRequestField.Raw[] | null; + tab?: string | null; + method?: string | null; + url?: string | null; + } +} diff --git a/src/serialization/types/HttpRequestField.ts b/src/serialization/types/HttpRequestField.ts new file mode 100644 index 0000000..e390b56 --- /dev/null +++ b/src/serialization/types/HttpRequestField.ts @@ -0,0 +1,20 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const HttpRequestField: core.serialization.ObjectSchema< + serializers.HttpRequestField.Raw, + Pipedream.HttpRequestField +> = core.serialization.object({ + name: core.serialization.string(), + value: core.serialization.string(), +}); + +export declare namespace HttpRequestField { + export interface Raw { + name: string; + value: string; + } +} diff --git a/src/serialization/types/ListProjectsResponse.ts b/src/serialization/types/ListProjectsResponse.ts new file mode 100644 index 0000000..97af4a0 --- /dev/null +++ b/src/serialization/types/ListProjectsResponse.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; +import { PageInfo } from "./PageInfo.js"; +import { Project } from "./Project.js"; + +export const ListProjectsResponse: core.serialization.ObjectSchema< + serializers.ListProjectsResponse.Raw, + Pipedream.ListProjectsResponse +> = core.serialization.object({ + data: core.serialization.list(Project), + pageInfo: core.serialization.property("page_info", PageInfo), +}); + +export declare namespace ListProjectsResponse { + export interface Raw { + data: Project.Raw[]; + page_info: PageInfo.Raw; + } +} diff --git a/src/serialization/types/Project.ts b/src/serialization/types/Project.ts new file mode 100644 index 0000000..f8c83fe --- /dev/null +++ b/src/serialization/types/Project.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const Project: core.serialization.ObjectSchema = + core.serialization.object({ + id: core.serialization.string(), + name: core.serialization.string(), + appName: core.serialization.property("app_name", core.serialization.string().optional()), + supportEmail: core.serialization.property("support_email", core.serialization.string().optional()), + }); + +export declare namespace Project { + export interface Raw { + id: string; + name: string; + app_name?: string | null; + support_email?: string | null; + } +} diff --git a/src/serialization/types/ProxyResponseBinary.ts b/src/serialization/types/ProxyResponseBinary.ts new file mode 100644 index 0000000..8a05a96 --- /dev/null +++ b/src/serialization/types/ProxyResponseBinary.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Pipedream from "../../api/index.js"; +import * as core from "../../core/index.js"; +import type * as serializers from "../index.js"; + +export const ProxyResponseBinary: core.serialization.Schema< + serializers.ProxyResponseBinary.Raw, + Pipedream.ProxyResponseBinary +> = core.serialization.string(); + +export declare namespace ProxyResponseBinary { + export type Raw = string; +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 4ebd911..b000db2 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -22,11 +22,14 @@ export * from "./ConfigurablePropApphook.js"; export * from "./ConfigurablePropBase.js"; export * from "./ConfigurablePropBoolean.js"; export * from "./ConfigurablePropBooleanOptionsItem.js"; +export * from "./ConfigurablePropDataStore.js"; export * from "./ConfigurablePropDb.js"; +export * from "./ConfigurablePropDir.js"; export * from "./ConfigurablePropDiscord.js"; export * from "./ConfigurablePropDiscordChannel.js"; export * from "./ConfigurablePropDiscordChannelArray.js"; export * from "./ConfigurablePropHttp.js"; +export * from "./ConfigurablePropHttpRequest.js"; export * from "./ConfigurablePropInteger.js"; export * from "./ConfigurablePropIntegerArray.js"; export * from "./ConfigurablePropIntegerArrayOptionsItem.js"; @@ -81,12 +84,21 @@ export * from "./GetTriggersResponse.js"; export * from "./GetTriggerWebhooksResponse.js"; export * from "./GetTriggerWorkflowsResponse.js"; export * from "./HttpInterface.js"; +export * from "./HttpRequestAuth.js"; +export * from "./HttpRequestAuthType.js"; +export * from "./HttpRequestBody.js"; +export * from "./HttpRequestBodyMode.js"; +export * from "./HttpRequestBodyType.js"; +export * from "./HttpRequestConfig.js"; +export * from "./HttpRequestField.js"; export * from "./ListAccountsResponse.js"; export * from "./ListAppCategoriesResponse.js"; export * from "./ListAppsResponse.js"; +export * from "./ListProjectsResponse.js"; export * from "./Observation.js"; export * from "./ObservationError.js"; export * from "./PageInfo.js"; +export * from "./Project.js"; export * from "./ProjectEnvironment.js"; export * from "./ProjectInfoResponse.js"; export * from "./ProjectInfoResponseApp.js"; @@ -94,6 +106,7 @@ export * from "./PropOption.js"; export * from "./PropOptionNested.js"; export * from "./PropOptionValue.js"; export * from "./ProxyResponse.js"; +export * from "./ProxyResponseBinary.js"; export * from "./ReloadPropsOpts.js"; export * from "./ReloadPropsResponse.js"; export * from "./RunActionOptsStashId.js"; diff --git a/src/version.ts b/src/version.ts index 7812a79..3003e8d 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const SDK_VERSION = "2.3.2"; +export const SDK_VERSION = "2.3.3";