import type { CountProjectsData, ListProjectMembersData, ListProjectsData, Project, ProjectCreateRequest, ProjectListItem, ProjectMember, ProjectMemberRoleResponse, ProjectPermission, ProjectRole, ProjectUpdateRequest } from "../../client/types.gen.js"; import type { CallOptions, RequestContext } from "../context.js"; import { type Paginated } from "../paginate.js"; import { type Outcome } from "../result.js"; /** Input for {@link Projects.transfer} (org → org). */ export interface TransferProjectsInput { /** Source org. Defaults to the client's `orgId`. */ fromOrgId?: string; /** Destination org. */ toOrgId: string; projectIds: string[]; } type ListQuery = Omit, "cursor">; type CountQuery = NonNullable; type CreateInput = ProjectCreateRequest["project"]; type UpdateInput = ProjectUpdateRequest["project"]; type MemberListQuery = Omit, "cursor">; /** Per-call options for {@link Members.setRole}. */ export type SetRoleOptions = CallOptions; /** Per-call options for {@link Members.removeRole}. */ export type RemoveRoleOptions = CallOptions; export type ProjectListParams = ListQuery; export type ProjectCountParams = CountQuery; export interface ProjectGetParams { projectId: string; } export type ProjectCreateParams = CreateInput; export type ProjectCreateAndConnectParams = CreateInput & { /** Return a pooled connection string (default `true`). */ pooled?: boolean; }; export type ProjectUpdateParams = UpdateInput & { projectId: string; }; export interface ProjectDeleteParams { projectId: string; } export interface ProjectRecoverParams { projectId: string; } export type ProjectTransferParams = TransferProjectsInput; export interface ProjectTransferFromUserParams { toOrgId: string; projectIds: string[]; } export interface ProjectPermissionListParams { projectId: string; } export interface ProjectPermissionGrantParams { projectId: string; email: string; } export interface ProjectPermissionRevokeParams { projectId: string; permissionId: string; } export type ProjectMemberListParams = MemberListQuery & { projectId: string; }; export interface ProjectMemberSetRoleParams { projectId: string; memberId: string; role: ProjectRole; /** * Acknowledge that the call lowers the caller's own role. The API rejects a * self-demotion without it, so it is left off by default. */ confirmSelfDemotion?: boolean; } export interface ProjectMemberRemoveRoleParams { projectId: string; memberId: string; /** * Acknowledge that the call can cost the caller management access. The API * rejects such a self-removal without it, so it is left off by default. */ confirmSelfLockout?: boolean; } /** A project with a ready-to-use connection string to its default branch. */ export interface ProjectConnection { project: Project; connectionString: string; } /** Project access grants (share a project with additional users by email). */ export declare class Permissions { #private; constructor(ctx: RequestContext); /** @apiCall GET /projects/{project_id}/permissions */ list(params: ProjectPermissionListParams): Promise>; list(params: ProjectPermissionListParams, opts: CallOptions): Promise>; /** @apiCall POST /projects/{project_id}/permissions */ grant(params: ProjectPermissionGrantParams): Promise>; grant(params: ProjectPermissionGrantParams, opts: CallOptions): Promise>; /** @apiCall DELETE /projects/{project_id}/permissions/{permission_id} */ revoke(params: ProjectPermissionRevokeParams): Promise>; revoke(params: ProjectPermissionRevokeParams, opts: CallOptions): Promise>; } /** * Per-project roles for members of the owning organization. * * Distinct from {@link Permissions}, which shares a project with an individual by * email address: these act on existing org members by member id, and clearing a * grant leaves the member's organization-role default in force rather than * removing their access. */ export declare class Members { #private; constructor(ctx: RequestContext); /** * List org members and their project roles (cursor-paginated). Org-owned * projects only — a personal project answers `404`, as does an org with * per-project role management disabled. * * @apiCall GET /projects/{project_id}/members (cursor-paginated) */ list(params: ProjectMemberListParams): Paginated; list(params: ProjectMemberListParams, opts: CallOptions): Paginated; /** * Set a member's explicit project role, replacing any existing grant. * Idempotent. Check `credential_rotation_recommended` and * `org_api_key_rotation_recommended` on the result — a downgrade can leave * credentials the member still holds. * * @apiCall PUT /projects/{project_id}/members/{member_id}/role */ setRole(params: ProjectMemberSetRoleParams): Promise>; setRole(params: ProjectMemberSetRoleParams, opts: CallOptions): Promise>; /** * Clear a member's explicit project grant. Idempotent, and a no-op when no * explicit grant exists. The member keeps whatever their organization role * grants by default, so this narrows access rather than removing it. * * @apiCall DELETE /projects/{project_id}/members/{member_id}/role */ removeRole(params: ProjectMemberRemoveRoleParams): Promise>; removeRole(params: ProjectMemberRemoveRoleParams, opts: CallOptions): Promise>; } /** Project resource — one API call per method (`list` is cursor-paginated). */ export declare class Projects { #private; /** Project access grants (share by email). */ readonly permissions: Permissions; /** Per-project roles for members of the owning organization. */ readonly members: Members; constructor(ctx: RequestContext); /** * List projects (cursor-paginated). Returns a lazy list — `await .all()`, `.page()`, * or `for await (… of …)`. * * @apiCall GET /projects */ list(params?: ProjectListParams): Paginated; list(params: ProjectListParams | undefined, opts: CallOptions): Paginated; /** * Number of active projects in the organization, without paging through * {@link Projects.list}. Projects being created or deleted are not counted. * * @apiCall GET /projects/count */ count(params?: ProjectCountParams): Promise>; count(params: ProjectCountParams | undefined, opts: CallOptions): Promise>; /** @apiCall GET /projects/{project_id} */ get(params: ProjectGetParams): Promise>; get(params: ProjectGetParams, opts: CallOptions): Promise>; /** * The API provides no way to skip the default branch or read-write compute. * This method retains its project-only result; use * {@link Projects.createAndConnect} or `postgres.connectionString` when a * connection string is needed. */ create(params?: ProjectCreateParams): Promise>; create(params: ProjectCreateParams | undefined, opts: CallOptions): Promise>; /** * Create a project and return a ready-to-use connection string to its default branch. * One API call plus readiness polling (the create response already carries the * connection URI). * * @workflow createProject + waitForReadiness */ createAndConnect(params?: ProjectCreateAndConnectParams): Promise>; createAndConnect(params: ProjectCreateAndConnectParams | undefined, opts: CallOptions): Promise>; /** @apiCall PATCH /projects/{project_id} */ update(params: ProjectUpdateParams): Promise>; update(params: ProjectUpdateParams, opts: CallOptions): Promise>; /** @apiCall DELETE /projects/{project_id} */ delete(params: ProjectDeleteParams): Promise>; delete(params: ProjectDeleteParams, opts: CallOptions): Promise>; /** * Recover a soft-deleted project within its retention window (beta). * * @apiCall POST /projects/{project_id}/recover */ recover(params: ProjectRecoverParams): Promise>; recover(params: ProjectRecoverParams, opts: CallOptions): Promise>; /** * Transfer projects from one organization to another (e.g. sponsored → paid). The * source org defaults to the client's `orgId`. Requires a key with access to both orgs. * * @apiCall POST /organizations/{source_org_id}/projects/transfer */ transfer(params: ProjectTransferParams): Promise>; transfer(params: ProjectTransferParams, opts: CallOptions): Promise>; /** * Transfer projects from the personal account to an organization. * * @apiCall POST /users/me/projects/transfer */ transferFromUser(params: ProjectTransferFromUserParams): Promise>; transferFromUser(params: ProjectTransferFromUserParams, opts: CallOptions): Promise>; } export {}; //# sourceMappingURL=projects.d.ts.map