// This file is auto-generated by @hey-api/openapi-ts import type { Client, Options as Options2, TDataShape, } from "../../util/api/client/index.ts"; import { client } from "./client.gen.ts"; import type { AcceptProjectTransferRequestData, AcceptProjectTransferRequestErrors, AcceptProjectTransferRequestResponses, AddNeonAuthDomainToRedirectUriWhitelistData, AddNeonAuthDomainToRedirectUriWhitelistErrors, AddNeonAuthDomainToRedirectUriWhitelistResponses, AddNeonAuthOauthProviderData, AddNeonAuthOauthProviderErrors, AddNeonAuthOauthProviderResponses, AddProjectJwksData, AddProjectJwksErrors, AddProjectJwksResponses, AssignOrganizationVpcEndpointData, AssignOrganizationVpcEndpointErrors, AssignOrganizationVpcEndpointResponses, AssignProjectVpcEndpointData, AssignProjectVpcEndpointErrors, AssignProjectVpcEndpointResponses, CountProjectBranchesData, CountProjectBranchesErrors, CountProjectBranchesResponses, CreateApiKeyData, CreateApiKeyErrors, CreateApiKeyResponses, CreateNeonAuthIntegrationData, CreateNeonAuthIntegrationErrors, CreateNeonAuthIntegrationResponses, CreateNeonAuthNewUserData, CreateNeonAuthNewUserErrors, CreateNeonAuthNewUserResponses, CreateNeonAuthProviderSdkKeysData, CreateNeonAuthProviderSdkKeysErrors, CreateNeonAuthProviderSdkKeysResponses, CreateOrganizationInvitationsData, CreateOrganizationInvitationsErrors, CreateOrganizationInvitationsResponses, CreateOrgApiKeyData, CreateOrgApiKeyErrors, CreateOrgApiKeyResponses, CreateProjectBranchData, CreateProjectBranchDataApiData, CreateProjectBranchDataApiErrors, CreateProjectBranchDataApiResponses, CreateProjectBranchDatabaseData, CreateProjectBranchDatabaseErrors, CreateProjectBranchDatabaseResponses, CreateProjectBranchErrors, CreateProjectBranchResponses, CreateProjectBranchRoleData, CreateProjectBranchRoleErrors, CreateProjectBranchRoleResponses, CreateProjectData, CreateProjectEndpointData, CreateProjectEndpointErrors, CreateProjectEndpointResponses, CreateProjectErrors, CreateProjectResponses, CreateProjectTransferRequestData, CreateProjectTransferRequestErrors, CreateProjectTransferRequestResponses, CreateSnapshotData, CreateSnapshotErrors, CreateSnapshotResponses, DeleteNeonAuthDomainFromRedirectUriWhitelistData, DeleteNeonAuthDomainFromRedirectUriWhitelistErrors, DeleteNeonAuthDomainFromRedirectUriWhitelistResponses, DeleteNeonAuthIntegrationData, DeleteNeonAuthIntegrationErrors, DeleteNeonAuthIntegrationResponses, DeleteNeonAuthOauthProviderData, DeleteNeonAuthOauthProviderErrors, DeleteNeonAuthOauthProviderResponses, DeleteNeonAuthUserData, DeleteNeonAuthUserErrors, DeleteNeonAuthUserResponses, DeleteOrganizationVpcEndpointData, DeleteOrganizationVpcEndpointErrors, DeleteOrganizationVpcEndpointResponses, DeleteProjectBranchData, DeleteProjectBranchDataApiData, DeleteProjectBranchDataApiErrors, DeleteProjectBranchDataApiResponses, DeleteProjectBranchDatabaseData, DeleteProjectBranchDatabaseErrors, DeleteProjectBranchDatabaseResponses, DeleteProjectBranchErrors, DeleteProjectBranchResponses, DeleteProjectBranchRoleData, DeleteProjectBranchRoleErrors, DeleteProjectBranchRoleResponses, DeleteProjectData, DeleteProjectEndpointData, DeleteProjectEndpointErrors, DeleteProjectEndpointResponses, DeleteProjectErrors, DeleteProjectJwksData, DeleteProjectJwksErrors, DeleteProjectJwksResponses, DeleteProjectResponses, DeleteProjectVpcEndpointData, DeleteProjectVpcEndpointErrors, DeleteProjectVpcEndpointResponses, DeleteSnapshotData, DeleteSnapshotErrors, DeleteSnapshotResponses, FinalizeRestoreBranchData, FinalizeRestoreBranchErrors, FinalizeRestoreBranchResponses, GetActiveRegionsData, GetActiveRegionsErrors, GetActiveRegionsResponses, GetAuthDetailsData, GetAuthDetailsErrors, GetAuthDetailsResponses, GetAvailablePreloadLibrariesData, GetAvailablePreloadLibrariesErrors, GetAvailablePreloadLibrariesResponses, GetConnectionUriData, GetConnectionUriErrors, GetConnectionUriResponses, GetConsumptionHistoryPerAccountData, GetConsumptionHistoryPerAccountErrors, GetConsumptionHistoryPerAccountResponses, GetConsumptionHistoryPerProjectData, GetConsumptionHistoryPerProjectErrors, GetConsumptionHistoryPerProjectResponses, GetCurrentUserInfoData, GetCurrentUserInfoErrors, GetCurrentUserInfoResponses, GetCurrentUserOrganizationsData, GetCurrentUserOrganizationsErrors, GetCurrentUserOrganizationsResponses, GetNeonAuthEmailServerData, GetNeonAuthEmailServerErrors, GetNeonAuthEmailServerResponses, GetOrganizationData, GetOrganizationErrors, GetOrganizationInvitationsData, GetOrganizationInvitationsErrors, GetOrganizationInvitationsResponses, GetOrganizationMemberData, GetOrganizationMemberErrors, GetOrganizationMemberResponses, GetOrganizationMembersData, GetOrganizationMembersErrors, GetOrganizationMembersResponses, GetOrganizationResponses, GetOrganizationVpcEndpointDetailsData, GetOrganizationVpcEndpointDetailsErrors, GetOrganizationVpcEndpointDetailsResponses, GetProjectBranchData, GetProjectBranchDataApiData, GetProjectBranchDataApiErrors, GetProjectBranchDataApiResponses, GetProjectBranchDatabaseData, GetProjectBranchDatabaseErrors, GetProjectBranchDatabaseResponses, GetProjectBranchErrors, GetProjectBranchResponses, GetProjectBranchRoleData, GetProjectBranchRoleErrors, GetProjectBranchRolePasswordData, GetProjectBranchRolePasswordErrors, GetProjectBranchRolePasswordResponses, GetProjectBranchRoleResponses, GetProjectBranchSchemaComparisonData, GetProjectBranchSchemaComparisonErrors, GetProjectBranchSchemaComparisonResponses, GetProjectBranchSchemaData, GetProjectBranchSchemaErrors, GetProjectBranchSchemaResponses, GetProjectData, GetProjectEndpointData, GetProjectEndpointErrors, GetProjectEndpointResponses, GetProjectErrors, GetProjectJwksData, GetProjectJwksErrors, GetProjectJwksResponses, GetProjectOperationData, GetProjectOperationErrors, GetProjectOperationResponses, GetProjectResponses, GrantPermissionToProjectData, GrantPermissionToProjectErrors, GrantPermissionToProjectResponses, ListApiKeysData, ListApiKeysErrors, ListApiKeysResponses, ListNeonAuthIntegrationsData, ListNeonAuthIntegrationsErrors, ListNeonAuthIntegrationsResponses, ListNeonAuthOauthProvidersData, ListNeonAuthOauthProvidersErrors, ListNeonAuthOauthProvidersResponses, ListNeonAuthRedirectUriWhitelistDomainsData, ListNeonAuthRedirectUriWhitelistDomainsErrors, ListNeonAuthRedirectUriWhitelistDomainsResponses, ListOrganizationVpcEndpointsAllRegionsData, ListOrganizationVpcEndpointsAllRegionsErrors, ListOrganizationVpcEndpointsAllRegionsResponses, ListOrganizationVpcEndpointsData, ListOrganizationVpcEndpointsErrors, ListOrganizationVpcEndpointsResponses, ListOrgApiKeysData, ListOrgApiKeysErrors, ListOrgApiKeysResponses, ListProjectBranchDatabasesData, ListProjectBranchDatabasesErrors, ListProjectBranchDatabasesResponses, ListProjectBranchEndpointsData, ListProjectBranchEndpointsErrors, ListProjectBranchEndpointsResponses, ListProjectBranchesData, ListProjectBranchesErrors, ListProjectBranchesResponses, ListProjectBranchRolesData, ListProjectBranchRolesErrors, ListProjectBranchRolesResponses, ListProjectEndpointsData, ListProjectEndpointsErrors, ListProjectEndpointsResponses, ListProjectOperationsData, ListProjectOperationsErrors, ListProjectOperationsResponses, ListProjectPermissionsData, ListProjectPermissionsErrors, ListProjectPermissionsResponses, ListProjectsData, ListProjectsErrors, ListProjectsResponses, ListProjectVpcEndpointsData, ListProjectVpcEndpointsErrors, ListProjectVpcEndpointsResponses, ListSharedProjectsData, ListSharedProjectsErrors, ListSharedProjectsResponses, ListSnapshotsData, ListSnapshotsErrors, ListSnapshotsResponses, RefreshSchemaCacheDataApiData, RefreshSchemaCacheDataApiErrors, RefreshSchemaCacheDataApiResponses, RemoveOrganizationMemberData, RemoveOrganizationMemberErrors, RemoveOrganizationMemberResponses, ResetProjectBranchRolePasswordData, ResetProjectBranchRolePasswordErrors, ResetProjectBranchRolePasswordResponses, RestartProjectEndpointData, RestartProjectEndpointErrors, RestartProjectEndpointResponses, RestoreProjectBranchData, RestoreProjectBranchErrors, RestoreProjectBranchResponses, RestoreSnapshotData, RestoreSnapshotErrors, RestoreSnapshotResponses, RevokeApiKeyData, RevokeApiKeyErrors, RevokeApiKeyResponses, RevokeOrgApiKeyData, RevokeOrgApiKeyErrors, RevokeOrgApiKeyResponses, RevokePermissionFromProjectData, RevokePermissionFromProjectErrors, RevokePermissionFromProjectResponses, SetDefaultProjectBranchData, SetDefaultProjectBranchErrors, SetDefaultProjectBranchResponses, StartProjectEndpointData, StartProjectEndpointErrors, StartProjectEndpointResponses, SuspendProjectEndpointData, SuspendProjectEndpointErrors, SuspendProjectEndpointResponses, TransferNeonAuthProviderProjectData, TransferNeonAuthProviderProjectErrors, TransferNeonAuthProviderProjectResponses, TransferProjectsFromOrgToOrgData, TransferProjectsFromOrgToOrgErrors, TransferProjectsFromOrgToOrgResponses, TransferProjectsFromUserToOrgData, TransferProjectsFromUserToOrgErrors, TransferProjectsFromUserToOrgResponses, UpdateNeonAuthEmailServerData, UpdateNeonAuthEmailServerErrors, UpdateNeonAuthEmailServerResponses, UpdateNeonAuthOauthProviderData, UpdateNeonAuthOauthProviderErrors, UpdateNeonAuthOauthProviderResponses, UpdateOrganizationMemberData, UpdateOrganizationMemberErrors, UpdateOrganizationMemberResponses, UpdateProjectBranchData, UpdateProjectBranchDatabaseData, UpdateProjectBranchDatabaseErrors, UpdateProjectBranchDatabaseResponses, UpdateProjectBranchErrors, UpdateProjectBranchResponses, UpdateProjectData, UpdateProjectEndpointData, UpdateProjectEndpointErrors, UpdateProjectEndpointResponses, UpdateProjectErrors, UpdateProjectResponses, UpdateSnapshotData, UpdateSnapshotErrors, UpdateSnapshotResponses, } from "./types.gen.ts"; export type Options< TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, > = Options2 & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a * custom client. */ client?: Client; /** * You can pass arbitrary values through the `meta` object. This can be * used to access values that aren't defined as part of the SDK function. */ meta?: Record; }; class _HeyApiClient { protected _client: Client = client; constructor(args?: { client?: Client }) { if (args?.client) { this._client = args.client; } } } export class NeonClient extends _HeyApiClient { /** * List API keys * Retrieves the API keys for your Neon account. * The response does not include API key tokens. A token is only provided when creating an API key. * API keys can also be managed in the Neon Console. * For more information, see [Manage API keys](https://neon.tech/docs/manage/api-keys/). * */ public listApiKeys( options?: Options, ) { return (options?.client ?? this._client).get< ListApiKeysResponses, ListApiKeysErrors, ThrowOnError >({ url: "/api_keys", ...options, }); } /** * Create API key * Creates an API key. * The `key_name` is a user-specified name for the key. * This method returns an `id` and `key`. The `key` is a randomly generated, 64-bit token required to access the Neon API. * API keys can also be managed in the Neon Console. * See [Manage API keys](https://neon.tech/docs/manage/api-keys/). * */ public createApiKey( options: Options, ) { return (options.client ?? this._client).post< CreateApiKeyResponses, CreateApiKeyErrors, ThrowOnError >({ url: "/api_keys", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Revoke API key * Revokes the specified API key. * An API key that is no longer needed can be revoked. * This action cannot be reversed. * You can obtain `key_id` values by listing the API keys for your Neon account. * API keys can also be managed in the Neon Console. * See [Manage API keys](https://neon.tech/docs/manage/api-keys/). * */ public revokeApiKey( options: Options, ) { return (options.client ?? this._client).delete< RevokeApiKeyResponses, RevokeApiKeyErrors, ThrowOnError >({ url: "/api_keys/{key_id}", ...options, }); } /** * Retrieve operation details * Retrieves details for the specified operation. * An operation is an action performed on a Neon project resource. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain a `operation_id` by listing operations for the project. * */ public getProjectOperation( options: Options, ) { return (options.client ?? this._client).get< GetProjectOperationResponses, GetProjectOperationErrors, ThrowOnError >({ url: "/projects/{project_id}/operations/{operation_id}", ...options, }); } /** * List projects * Retrieves a list of projects for an organization. * You may need to specify an org_id parameter depending on your API key type. * For more information, see [Manage projects](https://neon.tech/docs/manage/projects/). * */ public listProjects( options?: Options, ) { return (options?.client ?? this._client).get< ListProjectsResponses, ListProjectsErrors, ThrowOnError >({ url: "/projects", ...options, }); } /** * Create project * Creates a Neon project within an organization. * You may need to specify an org_id parameter depending on your API key type. * Plan limits define how many projects you can create. * For more information, see [Manage projects](https://neon.tech/docs/manage/projects/). * * You can specify a region and Postgres version in the request body. * Neon currently supports PostgreSQL 14, 15, 16, and 17. * For supported regions and `region_id` values, see [Regions](https://neon.tech/docs/introduction/regions/). * */ public createProject( options: Options, ) { return (options.client ?? this._client).post< CreateProjectResponses, CreateProjectErrors, ThrowOnError >({ url: "/projects", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * List shared projects * Retrieves a list of projects shared with your Neon account. * For more information, see [Manage projects](https://neon.tech/docs/manage/projects/). * */ public listSharedProjects( options?: Options, ) { return (options?.client ?? this._client).get< ListSharedProjectsResponses, ListSharedProjectsErrors, ThrowOnError >({ url: "/projects/shared", ...options, }); } /** * Delete project * Deletes the specified project. * You can obtain a `project_id` by listing the projects for your Neon account. * Deleting a project is a permanent action. * Deleting a project also deletes endpoints, branches, databases, and users that belong to the project. * */ public deleteProject( options: Options, ) { return (options.client ?? this._client).delete< DeleteProjectResponses, DeleteProjectErrors, ThrowOnError >({ url: "/projects/{project_id}", ...options, }); } /** * Retrieve project details * Retrieves information about the specified project. * You can obtain a `project_id` by listing the projects for an organization. * */ public getProject( options: Options, ) { return (options.client ?? this._client).get< GetProjectResponses, GetProjectErrors, ThrowOnError >({ url: "/projects/{project_id}", ...options, }); } /** * Update project * Updates the specified project. * You can obtain a `project_id` by listing the projects for your Neon account. * */ public updateProject( options: Options, ) { return (options.client ?? this._client).patch< UpdateProjectResponses, UpdateProjectErrors, ThrowOnError >({ url: "/projects/{project_id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * List operations * Retrieves a list of operations for the specified Neon project. * You can obtain a `project_id` by listing the projects for your Neon account. * The number of operations returned can be large. * To paginate the response, issue an initial request with a `limit` value. * Then, add the `cursor` value that was returned in the response to the next request. * Operations older than 6 months may be deleted from our systems. * If you need more history than that, you should store your own history. * */ public listProjectOperations( options: Options, ) { return (options.client ?? this._client).get< ListProjectOperationsResponses, ListProjectOperationsErrors, ThrowOnError >({ url: "/projects/{project_id}/operations", ...options, }); } /** * List project access * Retrieves details about users who have access to the project, including the permission `id`, the granted-to email address, and the date project access was granted. */ public listProjectPermissions( options: Options, ) { return (options.client ?? this._client).get< ListProjectPermissionsResponses, ListProjectPermissionsErrors, ThrowOnError >({ url: "/projects/{project_id}/permissions", ...options, }); } /** * Grant project access * Grants project access to the account associated with the specified email address */ public grantPermissionToProject( options: Options, ) { return (options.client ?? this._client).post< GrantPermissionToProjectResponses, GrantPermissionToProjectErrors, ThrowOnError >({ url: "/projects/{project_id}/permissions", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Revoke project access * Revokes project access from the user associated with the specified permission `id`. You can retrieve a user's permission `id` by listing project access. */ public revokePermissionFromProject( options: Options, ) { return (options.client ?? this._client).delete< RevokePermissionFromProjectResponses, RevokePermissionFromProjectErrors, ThrowOnError >({ url: "/projects/{project_id}/permissions/{permission_id}", ...options, }); } /** * Return available shared preload libraries * Return available shared preload libraries */ public getAvailablePreloadLibraries( options: Options, ) { return (options.client ?? this._client).get< GetAvailablePreloadLibrariesResponses, GetAvailablePreloadLibrariesErrors, ThrowOnError >({ url: "/projects/{project_id}/available_preload_libraries", ...options, }); } /** * Create a project transfer request * Creates a transfer request for the specified project. A transfer request allows * the project to be transferred to another account or organization. The request * has an expiration time after which it can no longer be used. To accept/claim * the transfer request, the recipient user/organization must call the * `/projects/{project_id}/transfer_requests/{request_id}` API endpoint, or visit * `https://console.neon.tech/app/claim?p={project_id}&tr={request_id}&ru={redirect_url}` * in the Neon Console. The `ru` parameter is optional and can be used to redirect * the user after accepting the transfer request. This feature is currently in * private preview. Get in touch with us to get access. * */ public createProjectTransferRequest( options: Options, ) { return (options.client ?? this._client).post< CreateProjectTransferRequestResponses, CreateProjectTransferRequestErrors, ThrowOnError >({ url: "/projects/{project_id}/transfer_requests", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Accept a project transfer request * Accepts a transfer request for the specified project, transferring it to the specified organization * or user. If org_id is not passed, the project will be transferred to the current user or organization account. * */ public acceptProjectTransferRequest( options: Options, ) { return (options.client ?? this._client).put< AcceptProjectTransferRequestResponses, AcceptProjectTransferRequestErrors, ThrowOnError >({ url: "/projects/{project_id}/transfer_requests/{request_id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * List JWKS URLs * Returns the JWKS URLs available for verifying JWTs used as the authentication mechanism for the specified project. * */ public getProjectJwks( options: Options, ) { return (options.client ?? this._client).get< GetProjectJwksResponses, GetProjectJwksErrors, ThrowOnError >({ url: "/projects/{project_id}/jwks", ...options, }); } /** * Add JWKS URL * Add a new JWKS URL to a project, such that it can be used for verifying JWTs used as the authentication mechanism for the specified project. * * The URL must be a valid HTTPS URL that returns a JSON Web Key Set. * * The `provider_name` field allows you to specify which authentication provider you're using (e.g., Clerk, Auth0, AWS Cognito, etc.). * * The `branch_id` can be used to specify on which branches the JWKS URL will be accepted. If not specified, then it will work on any branch. * * The `role_names` can be used to specify for which roles the JWKS URL will be accepted. If not specified, then default roles will be used (authenticator, authenticated and anonymous). * * The `jwt_audience` can be used to specify which "aud" values should be accepted by Neon in the JWTs that are used for authentication. * */ public addProjectJwks( options: Options, ) { return (options.client ?? this._client).post< AddProjectJwksResponses, AddProjectJwksErrors, ThrowOnError >({ url: "/projects/{project_id}/jwks", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Delete JWKS URL * Deletes a JWKS URL from the specified project */ public deleteProjectJwks( options: Options, ) { return (options.client ?? this._client).delete< DeleteProjectJwksResponses, DeleteProjectJwksErrors, ThrowOnError >({ url: "/projects/{project_id}/jwks/{jwks_id}", ...options, }); } /** * Delete Neon Data API * Deletes the Neon Data API for the specified branch. * You can obtain the `project_id` and `branch_id` by listing the projects and branches for your Neon account. * */ public deleteProjectBranchDataApi( options: Options, ) { return (options.client ?? this._client).delete< DeleteProjectBranchDataApiResponses, DeleteProjectBranchDataApiErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/data-api/{database_name}", ...options, }); } /** * Get Neon Data API * Retrieves the Neon Data API for the specified branch. * */ public getProjectBranchDataApi( options: Options, ) { return (options.client ?? this._client).get< GetProjectBranchDataApiResponses, GetProjectBranchDataApiErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/data-api/{database_name}", ...options, }); } /** * Refresh schema cache * Refreshes the schema cache for the Neon Data API in the specified branch. * You can obtain the `project_id` and `branch_id` by listing the projects and branches for your Neon account. * */ public refreshSchemaCacheDataApi( options: Options, ) { return (options.client ?? this._client).patch< RefreshSchemaCacheDataApiResponses, RefreshSchemaCacheDataApiErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/data-api/{database_name}", ...options, }); } /** * Create Neon Data API * Creates a new instance of Neon Data API in the specified branch. * You can obtain the `project_id` and `branch_id` by listing the projects and branches for your Neon account. * */ public createProjectBranchDataApi( options: Options, ) { return (options.client ?? this._client).post< CreateProjectBranchDataApiResponses, CreateProjectBranchDataApiErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/data-api/{database_name}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Create Neon Auth integration * Creates a project on a third-party authentication provider's platform for use with Neon Auth. * Use this endpoint if the frontend integration flow can't be used. * */ public createNeonAuthIntegration( options: Options, ) { return (options.client ?? this._client).post< CreateNeonAuthIntegrationResponses, CreateNeonAuthIntegrationErrors, ThrowOnError >({ url: "/projects/auth/create", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Delete domain from redirect_uri whitelist * Deletes a domain from the redirect_uri whitelist for the specified project. * */ public deleteNeonAuthDomainFromRedirectUriWhitelist< ThrowOnError extends boolean = true, >( options: Options< DeleteNeonAuthDomainFromRedirectUriWhitelistData, ThrowOnError >, ) { return (options.client ?? this._client).delete< DeleteNeonAuthDomainFromRedirectUriWhitelistResponses, DeleteNeonAuthDomainFromRedirectUriWhitelistErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/domains", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * List domains in redirect_uri whitelist * Lists the domains in the redirect_uri whitelist for the specified project. * */ public listNeonAuthRedirectUriWhitelistDomains< ThrowOnError extends boolean = true, >( options: Options, ) { return (options.client ?? this._client).get< ListNeonAuthRedirectUriWhitelistDomainsResponses, ListNeonAuthRedirectUriWhitelistDomainsErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/domains", ...options, }); } /** * Add domain to redirect_uri whitelist * Adds a domain to the redirect_uri whitelist for the specified project. * */ public addNeonAuthDomainToRedirectUriWhitelist< ThrowOnError extends boolean = true, >( options: Options, ) { return (options.client ?? this._client).post< AddNeonAuthDomainToRedirectUriWhitelistResponses, AddNeonAuthDomainToRedirectUriWhitelistErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/domains", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Create Auth Provider SDK keys * Generates SDK or API Keys for the auth provider. These might be called different things depending * on the auth provider you're using, but are generally used for setting up the frontend and backend SDKs. * */ public createNeonAuthProviderSdkKeys( options: Options, ) { return (options.client ?? this._client).post< CreateNeonAuthProviderSdkKeysResponses, CreateNeonAuthProviderSdkKeysErrors, ThrowOnError >({ url: "/projects/auth/keys", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Create new auth user * Creates a new user in Neon Auth. * The user will be created in your neon_auth.users_sync table and automatically propagated to your auth project, whether Neon-managed or provider-owned. * */ public createNeonAuthNewUser( options: Options, ) { return (options.client ?? this._client).post< CreateNeonAuthNewUserResponses, CreateNeonAuthNewUserErrors, ThrowOnError >({ url: "/projects/auth/user", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Delete auth user * Deletes the auth user for the specified project. * */ public deleteNeonAuthUser( options: Options, ) { return (options.client ?? this._client).delete< DeleteNeonAuthUserResponses, DeleteNeonAuthUserErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/users/{auth_user_id}", ...options, }); } /** * Transfer Neon-managed auth project to your own account * Transfer ownership of your Neon-managed auth project to your own auth provider account. * */ public transferNeonAuthProviderProject( options: Options, ) { return (options.client ?? this._client).post< TransferNeonAuthProviderProjectResponses, TransferNeonAuthProviderProjectErrors, ThrowOnError >({ url: "/projects/auth/transfer_ownership", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Lists active integrations with auth providers */ public listNeonAuthIntegrations( options: Options, ) { return (options.client ?? this._client).get< ListNeonAuthIntegrationsResponses, ListNeonAuthIntegrationsErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/integrations", ...options, }); } /** * List OAuth providers * Lists the OAuth providers for the specified project. * */ public listNeonAuthOauthProviders( options: Options, ) { return (options.client ?? this._client).get< ListNeonAuthOauthProvidersResponses, ListNeonAuthOauthProvidersErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/oauth_providers", ...options, }); } /** * Add a OAuth provider * Adds a OAuth provider to the specified project. * */ public addNeonAuthOauthProvider( options: Options, ) { return (options.client ?? this._client).post< AddNeonAuthOauthProviderResponses, AddNeonAuthOauthProviderErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/oauth_providers", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Delete OAuth provider * Deletes a OAuth provider from the specified project. * */ public deleteNeonAuthOauthProvider( options: Options, ) { return (options.client ?? this._client).delete< DeleteNeonAuthOauthProviderResponses, DeleteNeonAuthOauthProviderErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/oauth_providers/{oauth_provider_id}", ...options, }); } /** * Update OAuth provider * Updates a OAuth provider for the specified project. * */ public updateNeonAuthOauthProvider( options: Options, ) { return (options.client ?? this._client).patch< UpdateNeonAuthOauthProviderResponses, UpdateNeonAuthOauthProviderErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/oauth_providers/{oauth_provider_id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Get email server configuration * Gets the email server configuration for the specified project. * */ public getNeonAuthEmailServer( options: Options, ) { return (options.client ?? this._client).get< GetNeonAuthEmailServerResponses, GetNeonAuthEmailServerErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/email_server", ...options, }); } /** * Update email server configuration * Updates the email server configuration for the specified project. * */ public updateNeonAuthEmailServer( options: Options, ) { return (options.client ?? this._client).patch< UpdateNeonAuthEmailServerResponses, UpdateNeonAuthEmailServerErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/email_server", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Delete integration with auth provider */ public deleteNeonAuthIntegration( options: Options, ) { return (options.client ?? this._client).delete< DeleteNeonAuthIntegrationResponses, DeleteNeonAuthIntegrationErrors, ThrowOnError >({ url: "/projects/{project_id}/auth/integration/{auth_provider}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Retrieve connection URI * Retrieves a connection URI for the specified database. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `database_name` by listing the databases for a branch. * You can obtain a `role_name` by listing the roles for a branch. * */ public getConnectionUri( options: Options, ) { return (options.client ?? this._client).get< GetConnectionUriResponses, GetConnectionUriErrors, ThrowOnError >({ url: "/projects/{project_id}/connection_uri", ...options, }); } /** * List branches * Retrieves a list of branches for the specified project. * You can obtain a `project_id` by listing the projects for your Neon account. * * Each Neon project has a root branch named `main`. * A `branch_id` value has a `br-` prefix. * A project may contain child branches that were branched from `main` or from another branch. * A parent branch is identified by the `parent_id` value, which is the `id` of the parent branch. * For related information, see [Manage branches](https://neon.tech/docs/manage/branches/). * */ public listProjectBranches( options: Options, ) { return (options.client ?? this._client).get< ListProjectBranchesResponses, ListProjectBranchesErrors, ThrowOnError >({ url: "/projects/{project_id}/branches", ...options, }); } /** * Create branch * Creates a branch in the specified project. * You can obtain a `project_id` by listing the projects for your Neon account. * This method does not require a request body, but you can specify one to create a compute endpoint for the branch or to select a non-default parent branch. * By default, the branch is created from the project's default branch with no compute endpoint, and the branch name is auto-generated. * To access the branch, you must add an endpoint object. A `read_write` endpoint allows you to perform read and write operations on the branch. * Each branch supports one read-write endpoint and multiple read-only endpoints. * For related information, see [Manage branches](https://neon.tech/docs/manage/branches/). * */ public createProjectBranch( options: Options, ) { return (options.client ?? this._client).post< CreateProjectBranchResponses, CreateProjectBranchErrors, ThrowOnError >({ url: "/projects/{project_id}/branches", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Retrieve number of branches * Retrieves the total number of branches in the specified project. * You can obtain a `project_id` by listing the projects for your Neon account. * */ public countProjectBranches( options: Options, ) { return (options.client ?? this._client).get< CountProjectBranchesResponses, CountProjectBranchesErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/count", ...options, }); } /** * Delete branch * Deletes the specified branch from a project, and places * all compute endpoints into an idle state, breaking existing client connections. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain a `branch_id` by listing the project's branches. * For related information, see [Manage branches](https://neon.tech/docs/manage/branches/). * * When a successful response status is received, the compute endpoints are still active, * and the branch is not yet deleted from storage. * The deletion occurs after all operations finish. * You cannot delete a project's root or default branch, and you cannot delete a branch that has a child branch. * A project must have at least one branch. * */ public deleteProjectBranch( options: Options, ) { return (options.client ?? this._client).delete< DeleteProjectBranchResponses, DeleteProjectBranchErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}", ...options, }); } /** * Retrieve branch details * Retrieves information about the specified branch. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain a `branch_id` by listing the project's branches. * A `branch_id` value has a `br-` prefix. * * Each Neon project is initially created with a root and default branch named `main`. * A project can contain one or more branches. * A parent branch is identified by a `parent_id` value, which is the `id` of the parent branch. * For related information, see [Manage branches](https://neon.tech/docs/manage/branches/). * */ public getProjectBranch( options: Options, ) { return (options.client ?? this._client).get< GetProjectBranchResponses, GetProjectBranchErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}", ...options, }); } /** * Update branch * Updates the specified branch. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * For more information, see [Manage branches](https://neon.tech/docs/manage/branches/). * */ public updateProjectBranch( options: Options, ) { return (options.client ?? this._client).patch< UpdateProjectBranchResponses, UpdateProjectBranchErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Restore branch * Restores a branch to an earlier state in its own or another branch's history */ public restoreProjectBranch( options: Options, ) { return (options.client ?? this._client).post< RestoreProjectBranchResponses, RestoreProjectBranchErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/restore", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Retrieve database schema * Retrieves the schema from the specified database. The `lsn` and `timestamp` values cannot be specified at the same time. If both are omitted, the database schema is retrieved from database's head. */ public getProjectBranchSchema( options: Options, ) { return (options.client ?? this._client).get< GetProjectBranchSchemaResponses, GetProjectBranchSchemaErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/schema", ...options, }); } /** * Compare database schema * Compares the schema from the specified database with another branch's schema. */ public getProjectBranchSchemaComparison( options: Options, ) { return (options.client ?? this._client).get< GetProjectBranchSchemaComparisonResponses, GetProjectBranchSchemaComparisonErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/compare_schema", ...options, }); } /** * Set branch as default * Sets the specified branch as the project's default branch. * The default designation is automatically removed from the previous default branch. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * For more information, see [Manage branches](https://neon.tech/docs/manage/branches/). * */ public setDefaultProjectBranch( options: Options, ) { return (options.client ?? this._client).post< SetDefaultProjectBranchResponses, SetDefaultProjectBranchErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/set_as_default", ...options, }); } /** * Finalize restore * Finalize the restore operation for a branch created from a snapshot. * This operation updates the branch so it functions as the original branch it replaced. * This includes: * - Reassigning any computes from the original branch to the restored branch (this will restart the computes) * - Renaming the restored branch to the original branch's name * - Renaming the original branch so it no longer uses the original name * * This operation only applies to branches created using the `restoreSnapshot` endpoint with `finalize_restore: false`. * * **Note**: This endpoint is currently in Beta. * */ public finalizeRestoreBranch( options: Options, ) { return (options.client ?? this._client).post< FinalizeRestoreBranchResponses, FinalizeRestoreBranchErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/finalize_restore", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * List branch endpoints * Retrieves a list of compute endpoints for the specified branch. * Neon permits only one read-write compute endpoint per branch. * A branch can have multiple read-only compute endpoints. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * */ public listProjectBranchEndpoints( options: Options, ) { return (options.client ?? this._client).get< ListProjectBranchEndpointsResponses, ListProjectBranchEndpointsErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/endpoints", ...options, }); } /** * List databases * Retrieves a list of databases for the specified branch. * A branch can have multiple databases. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * For related information, see [Manage databases](https://neon.tech/docs/manage/databases/). * */ public listProjectBranchDatabases( options: Options, ) { return (options.client ?? this._client).get< ListProjectBranchDatabasesResponses, ListProjectBranchDatabasesErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/databases", ...options, }); } /** * Create database * Creates a database in the specified branch. * A branch can have multiple databases. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * For related information, see [Manage databases](https://neon.tech/docs/manage/databases/). * */ public createProjectBranchDatabase( options: Options, ) { return (options.client ?? this._client).post< CreateProjectBranchDatabaseResponses, CreateProjectBranchDatabaseErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/databases", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Delete database * Deletes the specified database from the branch. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` and `database_name` by listing the branch's databases. * For related information, see [Manage databases](https://neon.tech/docs/manage/databases/). * */ public deleteProjectBranchDatabase( options: Options, ) { return (options.client ?? this._client).delete< DeleteProjectBranchDatabaseResponses, DeleteProjectBranchDatabaseErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/databases/{database_name}", ...options, }); } /** * Retrieve database details * Retrieves information about the specified database. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` and `database_name` by listing the branch's databases. * For related information, see [Manage databases](https://neon.tech/docs/manage/databases/). * */ public getProjectBranchDatabase( options: Options, ) { return (options.client ?? this._client).get< GetProjectBranchDatabaseResponses, GetProjectBranchDatabaseErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/databases/{database_name}", ...options, }); } /** * Update database * Updates the specified database in the branch. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` and `database_name` by listing the branch's databases. * For related information, see [Manage databases](https://neon.tech/docs/manage/databases/). * */ public updateProjectBranchDatabase( options: Options, ) { return (options.client ?? this._client).patch< UpdateProjectBranchDatabaseResponses, UpdateProjectBranchDatabaseErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/databases/{database_name}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * List roles * Retrieves a list of Postgres roles from the specified branch. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * For related information, see [Manage roles](https://neon.tech/docs/manage/roles/). * */ public listProjectBranchRoles( options: Options, ) { return (options.client ?? this._client).get< ListProjectBranchRolesResponses, ListProjectBranchRolesErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/roles", ...options, }); } /** * Create role * Creates a Postgres role in the specified branch. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * For related information, see [Manage roles](https://neon.tech/docs/manage/roles/). * * Connections established to the active compute endpoint will be dropped. * If the compute endpoint is idle, the endpoint becomes active for a short period of time and is suspended afterward. * */ public createProjectBranchRole( options: Options, ) { return (options.client ?? this._client).post< CreateProjectBranchRoleResponses, CreateProjectBranchRoleErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/roles", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Delete role * Deletes the specified Postgres role from the branch. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * You can obtain the `role_name` by listing the roles for a branch. * For related information, see [Manage roles](https://neon.tech/docs/manage/roles/). * */ public deleteProjectBranchRole( options: Options, ) { return (options.client ?? this._client).delete< DeleteProjectBranchRoleResponses, DeleteProjectBranchRoleErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/roles/{role_name}", ...options, }); } /** * Retrieve role details * Retrieves details about the specified role. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * You can obtain the `role_name` by listing the roles for a branch. * In Neon, the terms "role" and "user" are synonymous. * For related information, see [Manage roles](https://neon.tech/docs/manage/roles/). * */ public getProjectBranchRole( options: Options, ) { return (options.client ?? this._client).get< GetProjectBranchRoleResponses, GetProjectBranchRoleErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/roles/{role_name}", ...options, }); } /** * Retrieve role password * Retrieves the password for the specified Postgres role, if possible. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * You can obtain the `role_name` by listing the roles for a branch. * For related information, see [Manage roles](https://neon.tech/docs/manage/roles/). * */ public getProjectBranchRolePassword( options: Options, ) { return (options.client ?? this._client).get< GetProjectBranchRolePasswordResponses, GetProjectBranchRolePasswordErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/roles/{role_name}/reveal_password", ...options, }); } /** * Reset role password * Resets the password for the specified Postgres role. * Returns a new password and operations. The new password is ready to use when the last operation finishes. * The old password remains valid until last operation finishes. * Connections to the compute endpoint are dropped. If idle, * the compute endpoint becomes active for a short period of time. * * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain the `branch_id` by listing the project's branches. * You can obtain the `role_name` by listing the roles for a branch. * For related information, see [Manage roles](https://neon.tech/docs/manage/roles/). * */ public resetProjectBranchRolePassword( options: Options, ) { return (options.client ?? this._client).post< ResetProjectBranchRolePasswordResponses, ResetProjectBranchRolePasswordErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/roles/{role_name}/reset_password", ...options, }); } /** * List VPC endpoint restrictions * Lists VPC endpoint restrictions for the specified Neon project. * */ public listProjectVpcEndpoints( options: Options, ) { return (options.client ?? this._client).get< ListProjectVpcEndpointsResponses, ListProjectVpcEndpointsErrors, ThrowOnError >({ url: "/projects/{project_id}/vpc_endpoints", ...options, }); } /** * Delete VPC endpoint restriction * Removes the specified VPC endpoint restriction from a Neon project. * */ public deleteProjectVpcEndpoint( options: Options, ) { return (options.client ?? this._client).delete< DeleteProjectVpcEndpointResponses, DeleteProjectVpcEndpointErrors, ThrowOnError >({ url: "/projects/{project_id}/vpc_endpoints/{vpc_endpoint_id}", ...options, }); } /** * Set VPC endpoint restriction * Sets or updates a VPC endpoint restriction for a Neon project. * When a VPC endpoint restriction is set, the project only accepts connections * from the specified VPC. * A VPC endpoint can be set as a restriction only after it is assigned to the * parent organization of the Neon project. * */ public assignProjectVpcEndpoint( options: Options, ) { return (options.client ?? this._client).post< AssignProjectVpcEndpointResponses, AssignProjectVpcEndpointErrors, ThrowOnError >({ url: "/projects/{project_id}/vpc_endpoints/{vpc_endpoint_id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * List compute endpoints * Retrieves a list of compute endpoints for the specified project. * A compute endpoint is a Neon compute instance. * You can obtain a `project_id` by listing the projects for your Neon account. * For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/). * */ public listProjectEndpoints( options: Options, ) { return (options.client ?? this._client).get< ListProjectEndpointsResponses, ListProjectEndpointsErrors, ThrowOnError >({ url: "/projects/{project_id}/endpoints", ...options, }); } /** * Create compute endpoint * Creates a compute endpoint for the specified branch. * An endpoint is a Neon compute instance. * There is a maximum of one read-write compute endpoint per branch. * If the specified branch already has a read-write compute endpoint, the operation fails. * A branch can have multiple read-only compute endpoints. * * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain `branch_id` by listing the project's branches. * A `branch_id` has a `br-` prefix. * For supported regions and `region_id` values, see [Regions](https://neon.tech/docs/introduction/regions/). * For more information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/). * */ public createProjectEndpoint( options: Options, ) { return (options.client ?? this._client).post< CreateProjectEndpointResponses, CreateProjectEndpointErrors, ThrowOnError >({ url: "/projects/{project_id}/endpoints", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Delete compute endpoint * Delete the specified compute endpoint. * A compute endpoint is a Neon compute instance. * Deleting a compute endpoint drops existing network connections to the compute endpoint. * The deletion is completed when last operation in the chain finishes successfully. * * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain an `endpoint_id` by listing your project's compute endpoints. * An `endpoint_id` has an `ep-` prefix. * For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/). * */ public deleteProjectEndpoint( options: Options, ) { return (options.client ?? this._client).delete< DeleteProjectEndpointResponses, DeleteProjectEndpointErrors, ThrowOnError >({ url: "/projects/{project_id}/endpoints/{endpoint_id}", ...options, }); } /** * Retrieve compute endpoint details * Retrieves information about the specified compute endpoint. * A compute endpoint is a Neon compute instance. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain an `endpoint_id` by listing your project's compute endpoints. * An `endpoint_id` has an `ep-` prefix. * For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/). * */ public getProjectEndpoint( options: Options, ) { return (options.client ?? this._client).get< GetProjectEndpointResponses, GetProjectEndpointErrors, ThrowOnError >({ url: "/projects/{project_id}/endpoints/{endpoint_id}", ...options, }); } /** * Update compute endpoint * Updates the specified compute endpoint. * * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain an `endpoint_id` and `branch_id` by listing your project's compute endpoints. * An `endpoint_id` has an `ep-` prefix. A `branch_id` has a `br-` prefix. * For more information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/). * * If the returned list of operations is not empty, the compute endpoint is not ready to use. * The client must wait for the last operation to finish before using the compute endpoint. * If the compute endpoint was idle before the update, it becomes active for a short period of time, * and the control plane suspends it again after the update. * */ public updateProjectEndpoint( options: Options, ) { return (options.client ?? this._client).patch< UpdateProjectEndpointResponses, UpdateProjectEndpointErrors, ThrowOnError >({ url: "/projects/{project_id}/endpoints/{endpoint_id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Start compute endpoint * Starts a compute endpoint. The compute endpoint is ready to use * after the last operation in chain finishes successfully. * * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain an `endpoint_id` by listing your project's compute endpoints. * An `endpoint_id` has an `ep-` prefix. * For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/). * */ public startProjectEndpoint( options: Options, ) { return (options.client ?? this._client).post< StartProjectEndpointResponses, StartProjectEndpointErrors, ThrowOnError >({ url: "/projects/{project_id}/endpoints/{endpoint_id}/start", ...options, }); } /** * Suspend compute endpoint * Suspend the specified compute endpoint * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain an `endpoint_id` by listing your project's compute endpoints. * An `endpoint_id` has an `ep-` prefix. * For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/). * */ public suspendProjectEndpoint( options: Options, ) { return (options.client ?? this._client).post< SuspendProjectEndpointResponses, SuspendProjectEndpointErrors, ThrowOnError >({ url: "/projects/{project_id}/endpoints/{endpoint_id}/suspend", ...options, }); } /** * Restart compute endpoint * Restart the specified compute endpoint: suspend immediately followed by start operations. * You can obtain a `project_id` by listing the projects for your Neon account. * You can obtain an `endpoint_id` by listing your project's compute endpoints. * An `endpoint_id` has an `ep-` prefix. * For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/). * */ public restartProjectEndpoint( options: Options, ) { return (options.client ?? this._client).post< RestartProjectEndpointResponses, RestartProjectEndpointErrors, ThrowOnError >({ url: "/projects/{project_id}/endpoints/{endpoint_id}/restart", ...options, }); } /** * Retrieve account consumption metrics * Retrieves consumption metrics for Scale, Business, and Enterprise plan accounts. History begins at the time of upgrade. * */ public getConsumptionHistoryPerAccount( options: Options, ) { return (options.client ?? this._client).get< GetConsumptionHistoryPerAccountResponses, GetConsumptionHistoryPerAccountErrors, ThrowOnError >({ url: "/consumption_history/account", ...options, }); } /** * Retrieve project consumption metrics * Retrieves consumption metrics for Scale, Business, and Enterprise plan projects. History begins at the time of upgrade. * Issuing a call to this API does not wake a project's compute endpoint. * */ public getConsumptionHistoryPerProject( options: Options, ) { return (options.client ?? this._client).get< GetConsumptionHistoryPerProjectResponses, GetConsumptionHistoryPerProjectErrors, ThrowOnError >({ url: "/consumption_history/projects", ...options, }); } /** * Retrieve organization details * Retrieves information about the specified organization. * */ public getOrganization( options: Options, ) { return (options.client ?? this._client).get< GetOrganizationResponses, GetOrganizationErrors, ThrowOnError >({ url: "/organizations/{org_id}", ...options, }); } /** * List organization API keys * Retrieves the API keys for the specified organization. * The response does not include API key tokens. A token is only provided when creating an API key. * API keys can also be managed in the Neon Console. * For more information, see [Manage API keys](https://neon.tech/docs/manage/api-keys/). * */ public listOrgApiKeys( options: Options, ) { return (options.client ?? this._client).get< ListOrgApiKeysResponses, ListOrgApiKeysErrors, ThrowOnError >({ url: "/organizations/{org_id}/api_keys", ...options, }); } /** * Create organization API key * Creates an API key for the specified organization. * The `key_name` is a user-specified name for the key. * This method returns an `id` and `key`. The `key` is a randomly generated, 64-bit token required to access the Neon API. * API keys can also be managed in the Neon Console. * See [Manage API keys](https://neon.tech/docs/manage/api-keys/). * */ public createOrgApiKey( options: Options, ) { return (options.client ?? this._client).post< CreateOrgApiKeyResponses, CreateOrgApiKeyErrors, ThrowOnError >({ url: "/organizations/{org_id}/api_keys", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Revoke organization API key * Revokes the specified organization API key. * An API key that is no longer needed can be revoked. * This action cannot be reversed. * You can obtain `key_id` values by listing the API keys for an organization. * API keys can also be managed in the Neon Console. * See [Manage API keys](https://neon.tech/docs/manage/api-keys/). * */ public revokeOrgApiKey( options: Options, ) { return (options.client ?? this._client).delete< RevokeOrgApiKeyResponses, RevokeOrgApiKeyErrors, ThrowOnError >({ url: "/organizations/{org_id}/api_keys/{key_id}", ...options, }); } /** * Retrieve organization members details * Retrieves information about the specified organization members. * */ public getOrganizationMembers( options: Options, ) { return (options.client ?? this._client).get< GetOrganizationMembersResponses, GetOrganizationMembersErrors, ThrowOnError >({ url: "/organizations/{org_id}/members", ...options, }); } /** * Remove member from the organization * Remove member from the organization. * Only an admin of the organization can perform this action. * If another admin is being removed, it will not be allows in case it is the only admin left in the organization. * */ public removeOrganizationMember( options: Options, ) { return (options.client ?? this._client).delete< RemoveOrganizationMemberResponses, RemoveOrganizationMemberErrors, ThrowOnError >({ url: "/organizations/{org_id}/members/{member_id}", ...options, }); } /** * Retrieve organization member details * Retrieves information about the specified organization member. * */ public getOrganizationMember( options: Options, ) { return (options.client ?? this._client).get< GetOrganizationMemberResponses, GetOrganizationMemberErrors, ThrowOnError >({ url: "/organizations/{org_id}/members/{member_id}", ...options, }); } /** * Update role for organization member * Only an admin can perform this action. * */ public updateOrganizationMember( options: Options, ) { return (options.client ?? this._client).patch< UpdateOrganizationMemberResponses, UpdateOrganizationMemberErrors, ThrowOnError >({ url: "/organizations/{org_id}/members/{member_id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Retrieve organization invitation details * Retrieves information about extended invitations for the specified organization * */ public getOrganizationInvitations( options: Options, ) { return (options.client ?? this._client).get< GetOrganizationInvitationsResponses, GetOrganizationInvitationsErrors, ThrowOnError >({ url: "/organizations/{org_id}/invitations", ...options, }); } /** * Create organization invitations * Creates invitations for a specific organization. * If the invited user has an existing account, they automatically join as a member. * If they don't yet have an account, they are invited to create one, after which they become a member. * Each invited user receives an email notification. * */ public createOrganizationInvitations( options: Options, ) { return (options.client ?? this._client).post< CreateOrganizationInvitationsResponses, CreateOrganizationInvitationsErrors, ThrowOnError >({ url: "/organizations/{org_id}/invitations", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Transfer projects between organizations * Transfers selected projects, identified by their IDs, from your organization to another specified organization. * */ public transferProjectsFromOrgToOrg( options: Options, ) { return (options.client ?? this._client).post< TransferProjectsFromOrgToOrgResponses, TransferProjectsFromOrgToOrgErrors, ThrowOnError >({ url: "/organizations/{source_org_id}/projects/transfer", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * List VPC endpoints across all regions * Retrieves the list of VPC endpoints for the specified Neon organization across all regions. * */ public listOrganizationVpcEndpointsAllRegions< ThrowOnError extends boolean = true, >( options: Options, ) { return (options.client ?? this._client).get< ListOrganizationVpcEndpointsAllRegionsResponses, ListOrganizationVpcEndpointsAllRegionsErrors, ThrowOnError >({ url: "/organizations/{org_id}/vpc/vpc_endpoints", ...options, }); } /** * List VPC endpoints * Retrieves the list of VPC endpoints for the specified Neon organization. * */ public listOrganizationVpcEndpoints( options: Options, ) { return (options.client ?? this._client).get< ListOrganizationVpcEndpointsResponses, ListOrganizationVpcEndpointsErrors, ThrowOnError >({ url: "/organizations/{org_id}/vpc/region/{region_id}/vpc_endpoints", ...options, }); } /** * Delete VPC endpoint * Deletes the VPC endpoint from the specified Neon organization. * If you delete a VPC endpoint from a Neon organization, that VPC endpoint cannot * be added back to the Neon organization. * */ public deleteOrganizationVpcEndpoint( options: Options, ) { return (options.client ?? this._client).delete< DeleteOrganizationVpcEndpointResponses, DeleteOrganizationVpcEndpointErrors, ThrowOnError >({ url: "/organizations/{org_id}/vpc/region/{region_id}/vpc_endpoints/{vpc_endpoint_id}", ...options, }); } /** * Retrieve VPC endpoint details * Retrieves the current state and configuration details of a specified VPC endpoint. * */ public getOrganizationVpcEndpointDetails( options: Options, ) { return (options.client ?? this._client).get< GetOrganizationVpcEndpointDetailsResponses, GetOrganizationVpcEndpointDetailsErrors, ThrowOnError >({ url: "/organizations/{org_id}/vpc/region/{region_id}/vpc_endpoints/{vpc_endpoint_id}", ...options, }); } /** * Assign or update VPC endpoint * Assigns a VPC endpoint to a Neon organization or updates its existing assignment. * */ public assignOrganizationVpcEndpoint( options: Options, ) { return (options.client ?? this._client).post< AssignOrganizationVpcEndpointResponses, AssignOrganizationVpcEndpointErrors, ThrowOnError >({ url: "/organizations/{org_id}/vpc/region/{region_id}/vpc_endpoints/{vpc_endpoint_id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * List supported regions * Lists supported Neon regions * */ public getActiveRegions( options?: Options, ) { return (options?.client ?? this._client).get< GetActiveRegionsResponses, GetActiveRegionsErrors, ThrowOnError >({ url: "/regions", ...options, }); } /** * Retrieve current user details * Retrieves information about the current Neon user account. * */ public getCurrentUserInfo( options?: Options, ) { return (options?.client ?? this._client).get< GetCurrentUserInfoResponses, GetCurrentUserInfoErrors, ThrowOnError >({ url: "/users/me", ...options, }); } /** * Retrieve current user organizations list * Retrieves information about the current Neon user's organizations * */ public getCurrentUserOrganizations( options?: Options, ) { return (options?.client ?? this._client).get< GetCurrentUserOrganizationsResponses, GetCurrentUserOrganizationsErrors, ThrowOnError >({ url: "/users/me/organizations", ...options, }); } /** * Transfer projects from personal account to organization * Transfers selected projects, identified by their IDs, from your personal account to a specified organization. * */ public transferProjectsFromUserToOrg( options: Options, ) { return (options.client ?? this._client).post< TransferProjectsFromUserToOrgResponses, TransferProjectsFromUserToOrgErrors, ThrowOnError >({ url: "/users/me/projects/transfer", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Get request authentication details * Returns auth information about the passed credentials. It can refer to an API key, Bearer token or OAuth session. * */ public getAuthDetails( options?: Options, ) { return (options?.client ?? this._client).get< GetAuthDetailsResponses, GetAuthDetailsErrors, ThrowOnError >({ url: "/auth", ...options, }); } /** * Create snapshot * Create a snapshot from the specified branch using the provided parameters. * This endpoint may initiate an asynchronous operation. * * **Note**: This endpoint is currently in Beta. * */ public createSnapshot( options: Options, ) { return (options.client ?? this._client).post< CreateSnapshotResponses, CreateSnapshotErrors, ThrowOnError >({ url: "/projects/{project_id}/branches/{branch_id}/snapshot", ...options, }); } /** * List project snapshots * List the snapshots for the specified project. * * **Note**: This endpoint is currently in Beta. * */ public listSnapshots( options: Options, ) { return (options.client ?? this._client).get< ListSnapshotsResponses, ListSnapshotsErrors, ThrowOnError >({ url: "/projects/{project_id}/snapshots", ...options, }); } /** * Delete snapshot * Delete the specified snapshot. * * **Note**: This endpoint is currently in Beta. * */ public deleteSnapshot( options: Options, ) { return (options.client ?? this._client).delete< DeleteSnapshotResponses, DeleteSnapshotErrors, ThrowOnError >({ url: "/projects/{project_id}/snapshots/{snapshot_id}", ...options, }); } /** * Update snapshot * Update the specified snapshot. * * **Note**: This endpoint is currently in Beta. * */ public updateSnapshot( options: Options, ) { return (options.client ?? this._client).patch< UpdateSnapshotResponses, UpdateSnapshotErrors, ThrowOnError >({ url: "/projects/{project_id}/snapshots/{snapshot_id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } /** * Restore snapshot * Restore the specified snapshot to a new branch and optionally finalize the restore operation. * * **Note**: This endpoint is currently in Beta. * */ public restoreSnapshot( options: Options, ) { return (options.client ?? this._client).post< RestoreSnapshotResponses, RestoreSnapshotErrors, ThrowOnError >({ url: "/projects/{project_id}/snapshots/{snapshot_id}/restore", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }); } }