declare const POSSIBLE_EVENTS: { readonly Ignite: readonly [{ readonly id: "ignite.deployment.created"; readonly name: "Deployment Created"; }, { readonly id: "ignite.deployment.updated"; readonly name: "Deployment Updated"; }, { readonly id: "ignite.deployment.deleted"; readonly name: "Deployment Deleted"; }, { readonly id: "ignite.deployment.build.created"; readonly name: "Build Created"; }, { readonly id: "ignite.deployment.build.started"; readonly name: "Build Started"; }, { readonly id: "ignite.deployment.build.updated"; readonly name: "Build Updated"; }, { readonly id: "ignite.deployment.build.completed"; readonly name: "Build Completed"; }, { readonly id: "ignite.deployment.build.failed"; readonly name: "Build Failed"; }, { readonly id: "ignite.deployment.build.cancelled"; readonly name: "Build Cancelled"; }, { readonly id: "ignite.deployment.rollout.created"; readonly name: "Rollout Created"; }, { readonly id: "ignite.deployment.rollout.updated"; readonly name: "Rollout Updated"; }, { readonly id: "ignite.deployment.container.created"; readonly name: "Container Created"; }, { readonly id: "ignite.deployment.container.updated"; readonly name: "Container Updated"; }, { readonly id: "ignite.deployment.container.metrics_update"; readonly name: "Container Metrics Update"; }, { readonly id: "ignite.deployment.container.deleted"; readonly name: "Container Deleted"; }, { readonly id: "ignite.deployment.healthcheck.created"; readonly name: "Healthcheck Created"; }, { readonly id: "ignite.deployment.healthcheck.updated"; readonly name: "Healthcheck Updated"; }, { readonly id: "ignite.deployment.healthcheck.deleted"; readonly name: "Healthcheck Deleted"; }, { readonly id: "ignite.deployment.healthcheck.events.failed"; readonly name: "Healthcheck Events Failed"; }, { readonly id: "ignite.deployment.healthcheck.events.succeeded"; readonly name: "Healthcheck Events Succeeded"; }, { readonly id: "ignite.deployment.gateway.created"; readonly name: "Gateway Created"; }, { readonly id: "ignite.deployment.gateway.updated"; readonly name: "Gateway Updated"; }, { readonly id: "ignite.deployment.gateway.deleted"; readonly name: "Gateway Deleted"; }]; readonly Project: readonly [{ readonly id: "project.updated"; readonly name: "Updated"; }, { readonly id: "project.member.created"; readonly name: "Member Created"; }, { readonly id: "project.member.updated"; readonly name: "Member Updated"; }, { readonly id: "project.member.deleted"; readonly name: "Member Deleted"; }, { readonly id: "project.tokens.created"; readonly name: "Token Created"; }, { readonly id: "project.tokens.deleted"; readonly name: "Token Deleted"; }, { readonly id: "project.secrets.created"; readonly name: "Secret Created"; }, { readonly id: "project.secrets.updated"; readonly name: "Secret Updated"; }, { readonly id: "project.secrets.deleted"; readonly name: "Secret Deleted"; }, { readonly id: "project.finance.transaction"; readonly name: "Finance Transaction"; }]; }; /** * Utility function to verify hmac signatures * * @param body The stringed body received from the request * @param signature The signature from the X-Hop-Hooks-Signature * @param secret The secret provided upon webhook creation to verify the signature. (e.x: whsec_xxxxx) */ declare function verifyHmac(body: string, signature: string, secret: string): Promise; /** * Utility function that returns a type-safe webhook event, throws if signature is invalid. * * @param body The stringed body received from the request * @param signature The signature from the X-Hop-Hooks-Signature * @param secret The secret provided upon webhook creation to verify the signature. (e.x: whsec_xxxxx) */ declare function constructEvent(body: string, signature: string, secret: string): Promise; /** * All methods the Hop API accepts * @public */ type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; /** * An empty response type * @public */ type Empty = void; /** * Makes individual properties optional in a type * @public */ type MakeOptional = Omit & Partial>; /** * Tag a type to make it unique * @public */ type Tag = T & { /** * Mark a type as having a specific name in the API * @internal */ ___tag: Name; }; /** * An ISO 8601 date strings * @public */ type Timestamp = Tag; /** * Creates a record of params required for a given URL/path * @public */ type ExtractRouteParams = string extends T ? Record : T extends `${string}:${infer Param}/${infer Rest}` ? { [k in Param | keyof ExtractRouteParams]: string | number; } : T extends `${string}:${infer Param}` ? { [k in Param]: string | number; } : {}; /** * An array of all IDs that can be used in the API * @public */ declare const ID_PREFIXES: readonly [{ readonly prefix: "user"; readonly description: "Users"; }, { readonly prefix: "project"; readonly description: "Project"; }, { readonly prefix: "pm"; readonly description: "Project Members"; }, { readonly prefix: "role"; readonly description: "Roles"; }, { readonly prefix: "pi"; readonly description: "Project Invite"; }, { readonly prefix: "ptk"; readonly description: "Project token"; }, { readonly prefix: "pat"; readonly description: "User personal access token"; }, { readonly prefix: "container"; readonly description: "Ignite container"; }, { readonly prefix: "pipe_room"; readonly description: "Pipe room"; }, { readonly prefix: "deployment"; readonly description: "Ignite deployment"; }, { readonly prefix: "bearer"; readonly description: "Users bearer token"; }, { readonly prefix: "ptkid"; readonly description: "Project token ID"; }, { readonly prefix: "secret"; readonly description: "Project secret ID"; }, { readonly prefix: "gateway"; readonly description: "Gateway"; }, { readonly prefix: "domain"; readonly description: "Domain for a gateway"; }, { readonly prefix: "leap_token"; readonly description: "Token for connecting to leap as a client"; }, { readonly prefix: "build"; readonly description: "Build ID for build logs"; }, { readonly prefix: "rollout"; readonly description: "Rollout ID for rollouts."; }, { readonly prefix: "health_check"; readonly description: "Health check ID for health checks."; }, { readonly prefix: "session"; readonly description: "Session ID for sessions on your account."; }, { readonly prefix: "webhook"; readonly description: "Webhook ID for webhooks on a project."; }, { readonly prefix: "deployment_group"; readonly description: "Group ID for Ignite deployments"; }, { readonly prefix: "fleet_group"; readonly description: "Group ID for fleet nodes"; }, { readonly prefix: "event"; readonly description: "Event ID for events sent by webhooks on a project."; }, { readonly prefix: "fleet_node"; readonly description: "Node ID for a fleet node"; }]; /** * A union of all ID prefixes used within the API * @public */ type IdPrefixes = (typeof ID_PREFIXES)[number]['prefix']; /** * A Hop ID is a string that starts with a prefix and a underscore, followed by some unique text. * It is a Pika ID — https://github.com/hopinc/pika * @public */ type Id = `${T}_${string}`; /** * A hop.sh domain (*.hop.sh) * @public */ type HopShDomain = `${string}.hop.sh`; /** * A domain used with internal gateways (*.hop.sh) * @public */ type InternalHopDomain = `${string}.hop`; /** * Any/all IDs that are used within the API * @public */ type AnyId = Id; /** * A union of all possible webhook groups */ type PossibleWebhookGroups = keyof typeof POSSIBLE_EVENTS; /** * A union of all possible webhook event IDs */ type PossibleWebhookIDs = (typeof POSSIBLE_EVENTS)[PossibleWebhookGroups][number]['id']; /** * Checks if a string is a valid Hop ID prefix * * @public * @param prefix - A string that is a potential prefix * @param expect - An expected prefix to check against * @returns - Whether the prefix is valid */ declare function validateIdPrefix(prefix: string, expect?: T): prefix is T; /** * Validates that a string is a valid ID * * @public * @param maybeId - A string that might be an id * @param prefix - Optionally an id prefix to check against * @returns true if the string is an id */ declare function validateId(maybeId: string | undefined | null, prefix?: T | T[]): maybeId is Id; /** * Gets the prefix of an ID * * @public * @param id - A full ID to extract the prefix from * @param expect - An expected prefix to check against * @returns - The prefix of the ID */ declare function getIdPrefix(id: string, expect?: T): T; /** * Casts a string to an ID and asserts that it is of the correct type. * This function will throw if the string is not a valid ID. * * @public * @param maybeId - Cast and assert that a string is an id * @param prefix - Optionally an prefix or array of prefixes to check against * @returns - The ID cast to the correct type */ declare function id(maybeId: string | undefined | null, prefix?: T | T[]): Id; /** * Asserts that a string is a valid ID * @public * @param maybeId - A string that is possibly an ID * @param prefix - A prefix or array of prefixes to check against * @param message - An error message to throw if the ID is invalid */ declare function assertId(maybeId: string | undefined | null, prefix?: T | T[], message?: string): asserts maybeId is Id; /** * The default base URL for Hop's API. * @public */ declare const DEFAULT_BASE_URL = "https://api.hop.io"; /** * If we are in the browser. * @public */ declare const IS_BROWSER: boolean; /** * If this runtiem supports the Intl API * @public */ declare const SUPPORTS_INTL: boolean; /** * API parsable byte size units strings * @public */ declare const byteUnits: readonly ["GB", "MB", "KB", "B"]; /** * Byte size unit type * @public */ type ByteUnit = (typeof byteUnits)[number]; /** * A string representing a byte size * @public */ type ByteSizeString = `${number}${ByteUnit}`; /** * @deprecated Use {@link ByteSizeString} instead * @public */ type ByteString = ByteSizeString; /** * Validates if a string is a valid byte size string * @param value - A string to validate if it is a valid byte size string * @returns If the string is a valid byte size string * @public */ declare function isValidByteString(value: string): value is ByteSizeString; /** * Helper function to converts a numerical size to a valid byte size string * @param size - A size to convert to a valid byte size string * @param unit - An optional unit to as the size unit. Defaults to B * @returns a byte size string * @public */ declare function bytes(size: number, unit?: ByteUnit): ByteSizeString; /** * Converts a kilobyte size to a byte size string * @param size - Kilobytes to convert to a byte size string * @returns a byte size string * @public */ declare function kilobytes(size: number): ByteSizeString; /** * Converts a megabyte size to a byte size string * @param size - Megabytes to convert to a byte size string * @returns a byte size string * @public */ declare function megabytes(size: number): ByteSizeString; /** * Converts a gigabyte size to a byte size string * @param size - Gigabytes to convert to a byte size string * @returns a byte size string * @public */ declare function gigabytes(size: number): ByteSizeString; /** * Parses a byte size string into bytes * @param size - The size of anything in gigabytes, megabytes, kilobytes or bytes * @public */ declare function parseSize(size: string): number; /** * @deprecated Use {@link byteUnits} instead * @public */ declare const units: readonly ["GB", "MB", "KB", "B"]; /** * All regions that Hop operates in * @public */ declare enum Regions { US_EAST_1 = "us-east-1" } /** * Runtime types are used to describe the type of a deployment or container * @public */ declare enum RuntimeType { /** * Ephemeral deployments/containers are sort of fire and forget. Containers won't restart if they exit but they can still be terminated programatically. */ EPHEMERAL = "ephemeral", /** * Persistent deployments/containers will restart if they exit. They can also be started and stopped programmatically. */ PERSISTENT = "persistent", /** * Stateful deployments/containers can only run one container at a time, and will have a persistent volume attached. */ STATEFUL = "stateful" } /** * An enum of states a container can be in * @public */ declare enum ContainerState { /** * The container is pending creation */ PENDING = "pending", /** * The container is running */ RUNNING = "running", /** * The container is stopped */ STOPPED = "stopped", /** * The container's entrypoint failed (e.g. exited with a non-zero exit code) */ FAILED = "failed", /** * The container is being deleted */ TERMINATING = "terminating", /** * The container exited (e.g. with a zero exit code) */ EXITED = "exited" } /** * Rollout state for deployments * @public */ declare enum RolloutState { PENDING = "pending", FINISHED = "finished", FAILED = "failed" } /** * Restart policy for deployments * @public */ declare enum RestartPolicy { NEVER = "never", ALWAYS = "always", ON_FAILURE = "on-failure" } /** * Formats of volumes * @public */ declare enum VolumeFormat { EXT4 = "ext4", XFS = "xfs" } /** * A definition of a volume * @public */ interface VolumeDefinition { /** * The format of the volume */ fs: VolumeFormat; /** * The size of the volume in bytes */ size: ByteSizeString; /** * The mount point of the volume */ mount_path: string; } interface ContainerMetrics { cpu_usage_percent: number; memory_usage_percent: number; memory_usage_bytes: number; } /** * The definition of a container * @public */ interface Container { /** * The ID of the container */ id: Id<'container'>; /** * The time this container was created */ created_at: Timestamp; /** * The region this container runs in */ region: Regions; /** * Information about uptime/downtime for this container */ uptime: { /** * The last time this container was started at */ last_start: Timestamp; }; /** * Metrics for this container */ metrics: ContainerMetrics | null; /** * Information about the container */ metadata: { /** * The last exit code */ last_exit_code?: number; }; /** * Overrides that were provided manually to the container */ overrides: { resources?: Partial; } | null; /** * The type of this container */ type: RuntimeType; /** * The volume definition for this container */ volume: VolumeDefinition | null; /** * The internal IP of the container */ internal_ip: string; /** * The ID of the deployment this container is associated with */ deployment_id: Id<'deployment'>; /** * The state this container is in */ state: ContainerState; } /** * A definition of a deployment * @public */ interface Deployment { /** * The ID of the deployment */ id: Id<'deployment'>; /** * The name of the deployment */ name: string; /** * The amount of containers this deployment is currently running */ container_count: number; /** * The time this deployment was created at */ created_at: Timestamp; /** * The config for this deployment */ config: Omit; /** * Current active rollout for deployment * @deprecated Use {@link Deployment.latest_rollout} instead */ active_rollout: DeploymentRollout | null; /** * Current active build for deployment */ active_build: Build | null; /** * The ID of the build currently being used in production by this deployment. * This will change if another build has been promoted to production. */ build_id: Build['id'] | null; /** * Current active rollout for deployment */ latest_rollout: DeploymentRollout | null; /** * The amount of containers in the running state */ running_container_count: number; /** * The target amount of containers a deployment should run */ target_container_count: number; /** * Metadata for deployment */ metadata: DeploymentMetadata | null; /** * Build cache settings for deployment */ build_cache_enabled: boolean; /** * Build settings for deployment */ build_settings?: BuildSettings; /** * The group the deployment belongs in */ group_id: Id<'deployment_group'> | null; /** * Target node for deployment, if its undefined its inferred as Hop */ target?: DeploymentTarget | undefined; } /** * A definition of a build's settings * @public */ interface BuildSettings { /** * Root directory for build */ root_directory?: string; /** * Specifies where the dockerfile is located */ dockerfile?: string; } /** * Deployment metadata * @public */ interface DeploymentMetadata { /** * Ports that have been found by container's runtime. */ container_port_mappings: Record, string[]>; /** * Whether a user has ignored the onboarding process. */ ignored_boarding?: boolean; /** * Whether the deployment was created from a preset. */ created_from_preset?: string; /** * Whether a gateway has been created for the deployment. */ created_first_gateway?: boolean; /** * Whether a user has acknowledged the ports that have been found by container's runtime. */ ports_acked?: string[]; } /** * Deployment metadata * @deprecated Use {@link DeploymentMetadata} instead * @public */ type DeploymentMetaData = DeploymentMetadata; /** * Metadata attached to a build * @public */ interface BuildMetadata { /** * Account type of repo owner */ account_type?: 'user' | 'organization'; /** * Author information about build */ author?: { /** * Author's Pfp */ avatar_url: string; /** * Author's username */ username: string; }; /** * Repo ID for build */ repo_id: number; /** * Repo name for build */ repo_name: string; /** * Repo branch for build */ branch: string; /** * commit SHA for build */ commit_sha: string; /** * commit message for build */ commit_msg: string; /** * commit URL for build */ commit_url?: string; } /** * Metadata attached to a build * @deprecated Use {@link BuildMetadata} instead * @public */ type BuildMetaData = BuildMetadata; /** * The inferred environment type of a build * @public */ declare enum BuildEnvironmentType { NIXPACKS = "nixpacks", DOCKERFILE = "dockerfile" } /** * The validated nixpacks plan for this build * @public */ interface NixPlan { language: string | null; pkgs: string[] | null; cmds: { build: string | null; start: string | null; install: string | null; }; } /** * Build environment contians information about the * language and build commands used to build the deployment * @public */ interface BuildEnvironment { type: BuildEnvironmentType; nix_plan?: NixPlan | null; } /** * Why the uploaded build content was rejected * @public */ interface ValidationFailure { reason: string; help_link: string | null; } /** * A build is a single build of a deployment * @public */ interface Build { /** * ID of the build */ id: Id<'build'>; /** * Deployment ID for build */ deployment_id: Id<'deployment'>; /** * Metadata pertaining to build (mostly for GitHub) */ metadata: BuildMetadata | null; /** * Build method (GitHub or CLI) */ method: BuildMethod; /** * Timestamp of when the build was created/queued */ created_at?: Timestamp; /** * Timestamp of when the build has started */ started_at: Timestamp | null; /** * Timestamp of when the build has finished */ finished_at: Timestamp | null; /** * Digest for image */ digest: string | null; /** * State of the build */ state: BuildState; /** * Environment for build */ environment: BuildEnvironment | null; /** * Validation failure for build; present if build state is VALIDATION_FAILED */ validation_failure: ValidationFailure | null; } /** * Information about a deployment's health check configuration * @public */ type HealthCheck = { /** * The ID of health check */ id: Id<'health_check'>; /** * Protocol for health check */ protocol: 'http'; /** * Path for health check */ path: string; /** * Port for health check */ port: number; /** * Interval for health check. This is how often the health check will be performed in seconds */ interval: number; /** * How long to wait for a response before considering the health check failed in milliseconds */ timeout: number; /** * How long we should wait when the container starts before performing the first health check. * This is useful for containers that take a while to start up, for example when running migrations. * This value is in seconds */ initial_delay: number; /** * Maximum number of consecutive failures before the container is considered unhealthy */ max_retries: number; /** * When the health check was created */ created_at: Timestamp; }; type Group = { /** * The ID of the group */ id: Id<'deployment_group'>; /** * The name of the group */ name: string; /** * The ID of the project the group belongs to */ project_id: Id<'project'>; /** * The position of the group in the list */ position: number; /** * The date the group was created */ created_at: Timestamp; }; /** * A deployment rollout * @public */ type DeploymentRollout = { /** * The rollout ID for rollout */ id: Id<'rollout'>; /** * The deployment ID for rollout */ deployment_id: Id<'deployment'>; /** * How many containers are being recreated */ count: number; /** * When the rollout took place */ created_at: Timestamp; /** * The state of the rollout */ state: RolloutState; /** * The build that triggered the rollout */ build: Build | null; /** * Container ID that the rollout is pertaining to */ init_container_id: string | null; /** * If a health check failed (causing the rollout to fail) */ health_check_failed: boolean; /** * Last time latest rollout was updated */ last_updated_at: Timestamp; /** * Has the rollout been acknowledged by a user */ acknowledged: boolean; }; /** * Data required to create a deployment * @internal */ type CreateDeploymentConfig = MakeOptional; /** * The strategy for scaling multiple containers. * @public */ declare enum ContainerStrategy { /** * Add containers yourself with the API or Console */ MANUAL = "manual" } /** * A deployment's config * @public */ interface DeploymentConfig { /** * The name of the deployment */ name: string; /** * The strategy for scaling multiple containers. */ container_strategy: ContainerStrategy; /** * The type of this deployment */ type: RuntimeType; /** * The version of this config */ version: '12-12-2022'; /** * Entrypoint command for the image */ cmd?: string[]; /** * The docker image config for this deployment */ image: Image; /** * Environment variables for this deployment */ env: Record; /** * Resources allocated to this deployment */ resources: Resources; /** * Restart policy for this deployment */ restart_policy: RestartPolicy; /** * The volume definition for this deployment * * This can only be used when .type is 'stateful' */ volume?: VolumeDefinition; /** * Entrypoint for this deployment */ entrypoint?: string[]; /** * Target node for deployment, if its undefined its inferred as Hop */ target?: DeploymentTarget | undefined; } /** * Docker image config * @public */ interface Image { /** * The name of the docker image */ name: string | null; /** * Authorization required for the registry to access this image * This is not required if you use Hop's own registry. */ auth: Auth | null; /** * GitHub repo information (if applicable) */ gh_repo: ImageGHRepo | null; } interface DeploymentTarget { /** * The type of target (Hop, Fleet Node) (fleet group coming later) */ type: 'hop' | 'fleet_node'; /** * The data of the target */ data: Node | null; } /** * Docker image registry authorization * @public */ interface Auth { username: string; password: string; } /** * GitHub repo type sent from API (NOT USED IN IMAGES) * @public */ interface GHRepo { id: number; full_name: string; private: boolean; default_branch: string; account_name: string; } /** * GitHub repo partial used for images * @public */ interface ImageGHRepo { repo_id: number; full_name: string; branch: string; } /** * Resources allocated to a deployment * @public */ interface Resources { /** * Amount of vCPU to allocate */ vcpu: number; /** * Amount of memory to allocate in a readible format * You can use the `parseSize` function to convert this to bytes. */ ram: ByteSizeString; } /** * Logs from a container * @public */ interface ContainerLog { /** * The timestamp of the log */ timestamp: Timestamp; /** * The log message */ message: string; /** * The ID of the document in elasticsearch. You probably won't have to use this, but * it might be useful for React keys, for example, as they are unique. */ nonce: string; /** * The level of the log * * ("error" and "log" are for backwards compatibility, new logs will be "stdout" and "stderr") */ level: 'stdout' | 'stderr' | 'error' | 'info'; } /** * Types of build methods supported by Hop * @public */ declare enum BuildMethod { GITHUB = "github", CLI = "cli" } /** * Types of gateways supported by Hop * @public */ declare enum GatewayType { /** * The gateway can only be accessed inside of a project's network */ INTERNAL = "internal", /** * The gateway can be accessed from the internet */ EXTERNAL = "external" } /** * Gateways are used to connect services to the internet or a private network * @public */ interface Gateway { /** * The ID of the gateway */ id: Id<'gateway'>; /** * The type of the gateway */ type: GatewayType; /** * The name of the gateway */ name: string; /** * The protocol for this gateway (Only for external) * * @alpha Currently, hop only supports HTTP. This will eventually change to an enum */ protocol: 'http' | null; /** * The deployment this gateway is associated with */ deployment_id: Id<'deployment'>; /** * The date this gateway was created */ created_at: Timestamp; /** * Domain automatically assigned by Hop */ hopsh_domain: HopShDomain | null; /** * Determines if the hop.sh domain is current active. */ hopsh_domain_enabled: boolean; /** * Internal domain assigned by user upon gateway creation */ internal_domain: InternalHopDomain | null; /** * Port the Gateway targets (Only for external gateways) */ target_port: number | null; /** * Domains associated with this gateway */ domains: Domain[]; } /** * An enum of states a domain can be in * @public */ declare enum DomainState { PENDING = "pending", VALID_CNAME = "valid_cname", SSL_ACTIVE = "ssl_active" } /** * An enum of states a build can be in * @public */ declare enum BuildState { VALIDATING = "validating", PENDING = "pending", FAILED = "failed", SUCCEEDED = "succeeded", CANCELLED = "cancelled", VALIDATION_FAILED = "validation_failed" } /** * A domain is a DNS record that points to a gateway * @public */ interface Domain { /** * The ID of the domain */ id: Id<'domain'>; /** * The domain name */ domain: string; /** * The domain state */ state: DomainState; /** * The date this domain was created */ created_at: Timestamp; /** * Where the domain redirects to and its status code, null if N/A */ redirect: DomainRedirect | null; } /** * A redirect setup for a domain * @public */ interface DomainRedirect { url: string; status_code: 301 | 302 | 307 | 308; } /** * All endpoints for the Ignite API * @public */ type IgniteEndpoints = Endpoint<'GET', '/v1/ignite/deployments', { deployments: Deployment[]; groups: Group[]; }> | Endpoint<'GET', '/v1/ignite/deployments/:deployment_id/containers', { containers: Container[]; }> | Endpoint<'POST', '/v1/ignite/deployments/:deployment_id/containers', { container: Container; }> | Endpoint<'POST', '/v1/ignite/deployments/:deployment_id/containers/:container_id', never, { /** * The ID of the deployment */ deployment_id: Id<'deployment'>; /** * The ID of the container */ container_id: Id<'container'>; }> | Endpoint<'POST', '/v1/ignite/deployments', { deployment: Deployment; }, CreateDeploymentConfig> | Endpoint<'DELETE', '/v1/ignite/deployments/:deployment_id', Empty> | Endpoint<'DELETE', '/v1/ignite/containers/:container_id', Empty | { container: Container; }> | Endpoint<'GET', '/v1/ignite/containers/:container_id/logs', { logs: ContainerLog[]; }> | Endpoint<'GET', '/v1/ignite/deployments/search', { deployment: Deployment; }> | Endpoint<'GET', '/v1/ignite/deployments/:deployment_id', { deployment: Deployment; }> | Endpoint<'PUT', '/v1/ignite/containers/:container_id/state', Empty, { /** * The state to update the container to */ preferred_state: ContainerState.STOPPED | ContainerState.RUNNING; }> | Endpoint<'POST', '/v1/ignite/gateways/:gateway_id/domains', Empty, { domain: string; }> | Endpoint<'GET', '/v1/ignite/gateways/:gateway_id', { gateway: Gateway; }> | Endpoint<'GET', '/v1/ignite/deployments/:deployment_id/gateways', { gateways: Gateway[]; }> | Endpoint<'POST', '/v1/ignite/deployments/:deployment_id/gateways', { gateway: Gateway; }, { type: GatewayType; target_port: number; protocol: Gateway['protocol']; name: string; }> | Endpoint<'PATCH', '/v1/ignite/deployments/:deployment_id', { deployment: Deployment; }, Partial> | Endpoint<'PATCH', '/v1/ignite/deployments/:deployment_id/metadata', { deployment: Deployment; }, Partial> | Endpoint<'POST', '/v1/ignite/deployments/:deployment_id/rollouts', { rollout: DeploymentRollout; }> | Endpoint<'POST', '/v1/ignite/deployments/:deployment_id/health-check', { health_check: HealthCheck; }, Omit> | Endpoint<'GET', '/v1/ignite/deployments/:deployment_id/storage', Record<'volume' | 'build_cache', Record<'provisioned_size' | 'used_size', number> | null>> | Endpoint<'PATCH', '/v1/ignite/deployments/:deployment_id/health-check', { health_check: HealthCheck; }, Partial>> | Endpoint<'DELETE', '/v1/ignite/domains/:domain_id', Empty> | Endpoint<'GET', '/v1/ignite/domains/:domain_id', { domain: Domain; }> | Endpoint<'POST', '/v1/ignite/groups', { group: Group; }, { name: string; deployment_ids: Id<'deployment'>[]; position?: number | undefined; }> | Endpoint<'PATCH', '/v1/ignite/groups/:group_id', { group: Group; }, { name?: string | undefined; position?: number | undefined; }> | Endpoint<'PUT', '/v1/ignite/groups/:group_id/deployments/:deployment_id', { group: Group; }> | Endpoint<'DELETE', '/v1/ignite/groups/:group_id', Empty> | Endpoint<'DELETE', '/v1/ignite/deployments/:deployment_id/group', Empty>; type ignite$1_Auth = Auth; type ignite$1_Build = Build; type ignite$1_BuildEnvironment = BuildEnvironment; type ignite$1_BuildEnvironmentType = BuildEnvironmentType; declare const ignite$1_BuildEnvironmentType: typeof BuildEnvironmentType; type ignite$1_BuildMetaData = BuildMetaData; type ignite$1_BuildMetadata = BuildMetadata; type ignite$1_BuildMethod = BuildMethod; declare const ignite$1_BuildMethod: typeof BuildMethod; type ignite$1_BuildSettings = BuildSettings; type ignite$1_BuildState = BuildState; declare const ignite$1_BuildState: typeof BuildState; type ignite$1_Container = Container; type ignite$1_ContainerLog = ContainerLog; type ignite$1_ContainerMetrics = ContainerMetrics; type ignite$1_ContainerState = ContainerState; declare const ignite$1_ContainerState: typeof ContainerState; type ignite$1_ContainerStrategy = ContainerStrategy; declare const ignite$1_ContainerStrategy: typeof ContainerStrategy; type ignite$1_CreateDeploymentConfig = CreateDeploymentConfig; type ignite$1_Deployment = Deployment; type ignite$1_DeploymentConfig = DeploymentConfig; type ignite$1_DeploymentMetaData = DeploymentMetaData; type ignite$1_DeploymentMetadata = DeploymentMetadata; type ignite$1_DeploymentRollout = DeploymentRollout; type ignite$1_DeploymentTarget = DeploymentTarget; type ignite$1_Domain = Domain; type ignite$1_DomainRedirect = DomainRedirect; type ignite$1_DomainState = DomainState; declare const ignite$1_DomainState: typeof DomainState; type ignite$1_GHRepo = GHRepo; type ignite$1_Gateway = Gateway; type ignite$1_GatewayType = GatewayType; declare const ignite$1_GatewayType: typeof GatewayType; type ignite$1_Group = Group; type ignite$1_HealthCheck = HealthCheck; type ignite$1_IgniteEndpoints = IgniteEndpoints; type ignite$1_Image = Image; type ignite$1_ImageGHRepo = ImageGHRepo; type ignite$1_NixPlan = NixPlan; type ignite$1_Regions = Regions; declare const ignite$1_Regions: typeof Regions; type ignite$1_Resources = Resources; type ignite$1_RestartPolicy = RestartPolicy; declare const ignite$1_RestartPolicy: typeof RestartPolicy; type ignite$1_RolloutState = RolloutState; declare const ignite$1_RolloutState: typeof RolloutState; type ignite$1_RuntimeType = RuntimeType; declare const ignite$1_RuntimeType: typeof RuntimeType; type ignite$1_ValidationFailure = ValidationFailure; type ignite$1_VolumeDefinition = VolumeDefinition; type ignite$1_VolumeFormat = VolumeFormat; declare const ignite$1_VolumeFormat: typeof VolumeFormat; declare namespace ignite$1 { export { ignite$1_Auth as Auth, ignite$1_Build as Build, ignite$1_BuildEnvironment as BuildEnvironment, ignite$1_BuildEnvironmentType as BuildEnvironmentType, ignite$1_BuildMetaData as BuildMetaData, ignite$1_BuildMetadata as BuildMetadata, ignite$1_BuildMethod as BuildMethod, ignite$1_BuildSettings as BuildSettings, ignite$1_BuildState as BuildState, ignite$1_Container as Container, ignite$1_ContainerLog as ContainerLog, ignite$1_ContainerMetrics as ContainerMetrics, ignite$1_ContainerState as ContainerState, ignite$1_ContainerStrategy as ContainerStrategy, ignite$1_CreateDeploymentConfig as CreateDeploymentConfig, ignite$1_Deployment as Deployment, ignite$1_DeploymentConfig as DeploymentConfig, ignite$1_DeploymentMetaData as DeploymentMetaData, ignite$1_DeploymentMetadata as DeploymentMetadata, ignite$1_DeploymentRollout as DeploymentRollout, ignite$1_DeploymentTarget as DeploymentTarget, ignite$1_Domain as Domain, ignite$1_DomainRedirect as DomainRedirect, ignite$1_DomainState as DomainState, ignite$1_GHRepo as GHRepo, ignite$1_Gateway as Gateway, ignite$1_GatewayType as GatewayType, ignite$1_Group as Group, ignite$1_HealthCheck as HealthCheck, ignite$1_IgniteEndpoints as IgniteEndpoints, ignite$1_Image as Image, ignite$1_ImageGHRepo as ImageGHRepo, ignite$1_NixPlan as NixPlan, ignite$1_Regions as Regions, ignite$1_Resources as Resources, ignite$1_RestartPolicy as RestartPolicy, ignite$1_RolloutState as RolloutState, ignite$1_RuntimeType as RuntimeType, ignite$1_ValidationFailure as ValidationFailure, ignite$1_VolumeDefinition as VolumeDefinition, ignite$1_VolumeFormat as VolumeFormat, }; } /** * A protocol that can be used to deliver a stream * @public */ type DeliveryProtocol = 'webrtc' | 'hls'; /** * A room that you can stream to * @public */ interface Room { /** * The ID of this stream */ id: Id<'pipe_room'>; /** * The name of this room */ name: string; /** * The unix timestamp of when this stream was created */ created_at: Timestamp; /** * Protocol you can stream with */ ingest_protocol: 'rtmp'; /** * Protocols that are supported by this room to the client */ delivery_protocols: DeliveryProtocol[]; /** * A join token to subscribe into this room */ join_token: string; /** * The region that the stream url is located in */ ingest_region: Regions; /** * The URL that you can stream to */ ingest_endpoint: string; /** * The state of the stream currently */ state: 'live' | 'offline'; } /** * The endpoints for the pipe API * @public */ type PipeEndpoints = Endpoint<'GET', '/v1/pipe/rooms', { rooms: Room[]; }> | Endpoint<'POST', '/v1/pipe/rooms', { room: Room; }, { /** * The name of the stream */ name: string; ingest_protocol: 'rtmp' | 'rtp'; delivery_protocols: DeliveryProtocol[]; region: Regions; ephemeral: boolean; llhls_config?: { wcl_delay: number; artificial_delay: number; max_playout_bitrate_preset: string; } | undefined; }> | Endpoint<'DELETE', '/v1/pipe/rooms/:room_id', Empty>; type pipe$1_DeliveryProtocol = DeliveryProtocol; type pipe$1_PipeEndpoints = PipeEndpoints; type pipe$1_Room = Room; declare namespace pipe$1 { export { pipe$1_DeliveryProtocol as DeliveryProtocol, pipe$1_PipeEndpoints as PipeEndpoints, pipe$1_Room as Room, }; } /** * A user object * @public */ interface User { /** * The ID of the user */ id: Id<'user'>; /** * The name of the user. Think of this as a display name */ name: string; /** * A unqiue username for the user */ username: string; /** * The email of the user */ email: string; /** * The date the user was created */ created_at: Timestamp; } /** * Self User Object * @public */ interface SelfUser extends User { /** * If user has verified their email */ email_verified: boolean; /** * If user has enabled totp authentication */ totp_enabled: boolean; /** * If user has enabled webauthn authentication */ webauthn_enabled: boolean; /** * If user has enabled mfa authentication */ mfa_enabled: boolean; /** * If user is an admin */ admin: boolean; } /** * A personal access token * @public */ interface PAT { /** * The ID of the pat */ id: Id<'pat'>; /** * The name of the pat */ name: string | null; /** * The pat token * * @alpha This value will be partially censored if it */ pat: string; /** * The date the pat was created */ created_at: Timestamp; } /** * All user endpoints * @public */ type UserEndpoints = Endpoint<'GET', '/v1/users/@me', { projects: Project[]; user: SelfUser; project_member_role_map: Record, MemberRole>; leap_token: string | null; }> | Endpoint<'POST', '/v1/users/@me/pats', { pat: PAT; }, { name: string; }> | Endpoint<'GET', '/v1/users/@me/pats', { pats: PAT[]; }> | Endpoint<'DELETE', '/v1/users/@me/pats/:pat_id', Empty>; type users$1_PAT = PAT; type users$1_SelfUser = SelfUser; type users$1_User = User; type users$1_UserEndpoints = UserEndpoints; declare namespace users$1 { export { users$1_PAT as PAT, users$1_SelfUser as SelfUser, users$1_User as User, users$1_UserEndpoints as UserEndpoints, }; } /** * A member is a partial user with information about their membership in a project * @public */ type Member = Omit & { /** * The ID of the project member */ id: Id<'pm'>; /** * The role that this member has in a project */ role: MemberRole; /** * If user has multi-factor authentication enabled. */ mfa_enabled: boolean; /** * The date that this member joined the project */ joined_at: Timestamp; }; /** * A project tier * @public */ declare enum ProjectTier { FREE = "free", PAID = "paid" } /** * A role that a member can have in a project * @public */ interface MemberRole { /** * The ID of the role */ id: Id<'role'>; /** * The name of the role */ name: string; /** * The flags for this role */ flags: number; } /** * A project token for a project * @public */ interface ProjectToken { /** * The Id of the project token */ id: Id<'ptkid'>; /** * The key value. This will likely have half of the key obfuscated */ token: Id<'ptk'>; /** * The time this project token was created */ created_at: Timestamp; /** * Permissions and flags that this project token can perform */ flags: number; } /** * Type of a project * @public */ declare enum ProjectType { /** * A standard project type */ REGULAR = "regular", /** * A personal project are created when you register an account */ PERSONAL = "personal" } /** * A project on Hop * @public */ interface Project { /** * The ID of the project */ id: Id<'project'>; /** * The name of the project */ name: string; /** * The tier this project is */ tier: ProjectTier; /** * The time this project was created at */ created_at: Timestamp; /** * An icon for this project */ icon: string | null; /** * The registry namespace for this project */ namespace: string; /** * The type of this project. Either regular or personal */ type: ProjectType; default_quotas: DefaultQuotas; quota_overrides: QuotaOverrides; quota_usage: QuotaUsage; } /** * Default quotas for a project * @public */ interface DefaultQuotas { vcpu: number; ram: number; volume: number; } /** * Quota overrides for a project * @public */ interface QuotaOverrides { } /** * Current usage of a quota for a project * @public */ interface QuotaUsage { vcpu: number; ram: number; volume: number; } /** * A secret is a key/value pair that can be used to store sensitive information * @public */ interface Secret { /** * The ID of the secret */ id: Id<'secret'>; /** * The name of the secret */ name: string; /** * A digest hash of the secret */ digest: string; /** * The time this secret was created at */ created_at: Timestamp; /** * Deployment IDs this secret is used by */ in_use_by: Id<'deployment'>[]; } /** * Webhooks are used to send an event to an endpoint when something within Hop happens. * @public */ interface Webhook { /** * The time this webhook was created at */ created_at: Timestamp; /** * The events that this webhook is subscribed to */ events: PossibleWebhookIDs[]; /** * The ID of the webhook */ id: Id<'webhook'>; /** * The ID of the project this webhook is for */ project_id: Id<'project'>; /** * The secret for this webhook * @warning This is censored after creation * @example whsec_xxxxxxxx */ secret: string; /** * The type of the webhook */ type: 'http'; /** * The URL that this webhook will send events to, acts as an endpoint */ webhook_url: string; } /** * An event is sent from a webhook to an endpoint */ interface HealthCheckEventUpdate { state: 'failed' | 'succeeded' | 'pending'; container_id: string; deployment_id: string; } type EventDataMap = { 'ignite.deployment.container.updated': Container; 'ignite.deployment.container.created': Container; 'ignite.deployment.container.deleted': Container; 'ignite.deployment.created': Deployment; 'ignite.deployment.updated': Deployment; 'ignite.deployment.deleted': Deployment; 'ignite.deployment.build.created': Build; 'ignite.deployment.build.updated': Build; 'ignite.deployment.rollout.created': DeploymentRollout; 'ignite.deployment.rollout.updated': DeploymentRollout; 'ignite.deployment.container.metrics_update': ContainerMetrics; 'ignite.deployment.healthcheck.created': HealthCheck; 'ignite.deployment.healthcheck.updated': HealthCheck; 'ignite.deployment.healthcheck.deleted': HealthCheck; 'ignite.deployment.healthcheck.events.failed': HealthCheckEventUpdate; 'ignite.deployment.healthcheck.events.succeeded': HealthCheckEventUpdate; 'ignite.deployment.gateway.created': Gateway; 'ignite.deployment.gateway.updated': Gateway; 'ignite.deployment.gateway.deleted': Gateway; 'project.updated': Project; 'project.member.created': Member; 'project.member.updated': Member; 'project.member.deleted': Member; 'project.tokens.created': ProjectToken; 'project.tokens.deleted': ProjectToken; 'project.secrets.created': Secret; 'project.secrets.updated': Secret; 'project.secrets.deleted': Secret; [key: string]: unknown; }; type Events = E[keyof E]; type Event = Events<{ [Key in PossibleWebhookIDs]: { webhook_id: Id<'webhook'>; /** * The ID of the project that this event is for */ project_id: Id<'project'>; /** * The time this event occurred at */ occurred_at: string; /** * The ID of the event */ id: Id<'event'>; /** * The event that occurred */ event: Key; /** * The data the belongs to the event */ data: EventDataMap[Key]; }; }>; type ProjectsEndpoints = Endpoint<'DELETE', '/v1/projects/:project_id/tokens/:project_token_id', Empty> | Endpoint<'DELETE', '/v1/projects/@this/tokens/:project_token_id', Empty> | Endpoint<'GET', '/v1/projects/:project_id/members/@me', { project_member: Member; }> | Endpoint<'GET', '/v1/projects/:project_id/tokens', { project_tokens: ProjectToken[]; }> | Endpoint<'GET', '/v1/projects/@this/tokens', { project_tokens: ProjectToken[]; }> | Endpoint<'GET', '/v1/projects/:project_id/members', { members: Member[]; }> | Endpoint<'GET', '/v1/projects/@this/members', { members: Member[]; }> | Endpoint<'POST', '/v1/projects/:project_id/tokens', { project_token: ProjectToken & { project: Project; }; }, { flags: number; }> | Endpoint<'POST', '/v1/projects/@this/tokens', { project_token: ProjectToken & { project: Project; }; }, { flags: number; }> | Endpoint<'PUT', '/v1/projects/:project_id/secrets/:name', { secret: Secret; }, string> | Endpoint<'PUT', '/v1/projects/@this/secrets/:name', { secret: Secret; }, string> | Endpoint<'GET', '/v1/projects/:project_id/secrets', { secrets: Secret[]; }> | Endpoint<'GET', '/v1/projects/@this/secrets', { secrets: Secret[]; }> | Endpoint<'DELETE', '/v1/projects/:project_id/secrets/:secret_id', Empty> | Endpoint<'DELETE', '/v1/projects/@this/secrets/:secret_id', Empty> | Endpoint<'GET', '/v1/projects/:project_id/webhooks', { webhooks: Webhook[]; }> | Endpoint<'GET', '/v1/projects/@this/webhooks', { webhooks: Webhook[]; }> | Endpoint<'POST', '/v1/projects/:project_id/webhooks', { webhook: Webhook; }, { webhook_url: string; events: PossibleWebhookIDs[]; }> | Endpoint<'POST', '/v1/projects/@this/webhooks', { webhook: Webhook; }, { webhook_url: string; events: PossibleWebhookIDs[]; }> | Endpoint<'PATCH', '/v1/projects/:project_id/webhooks/:webhook_id', { webhook: Webhook; }, { webhook_url: string | undefined; events: PossibleWebhookIDs[] | undefined; }> | Endpoint<'PATCH', '/v1/projects/@this/webhooks/:webhook_id', { webhook: Webhook; }, { webhook_url: string | undefined; events: PossibleWebhookIDs[] | undefined; }> | Endpoint<'DELETE', '/v1/projects/:project_id/webhooks/:webhook_id', Empty> | Endpoint<'DELETE', '/v1/projects/@this/webhooks/:webhook_id', Empty> | Endpoint<'POST', '/v1/projects/:project_id/webhooks/:webhook_id/regenerate', { secret: Webhook['secret']; }> | Endpoint<'POST', '/v1/projects/@this/webhooks/:webhook_id/regenerate', { secret: Webhook['secret']; }>; type projects$1_DefaultQuotas = DefaultQuotas; type projects$1_Event = Event; type projects$1_EventDataMap = EventDataMap; type projects$1_HealthCheckEventUpdate = HealthCheckEventUpdate; type projects$1_Member = Member; type projects$1_MemberRole = MemberRole; type projects$1_Project = Project; type projects$1_ProjectTier = ProjectTier; declare const projects$1_ProjectTier: typeof ProjectTier; type projects$1_ProjectToken = ProjectToken; type projects$1_ProjectType = ProjectType; declare const projects$1_ProjectType: typeof ProjectType; type projects$1_ProjectsEndpoints = ProjectsEndpoints; type projects$1_QuotaOverrides = QuotaOverrides; type projects$1_QuotaUsage = QuotaUsage; type projects$1_Secret = Secret; type projects$1_Webhook = Webhook; declare namespace projects$1 { export { projects$1_DefaultQuotas as DefaultQuotas, projects$1_Event as Event, projects$1_EventDataMap as EventDataMap, projects$1_HealthCheckEventUpdate as HealthCheckEventUpdate, projects$1_Member as Member, projects$1_MemberRole as MemberRole, projects$1_Project as Project, projects$1_ProjectTier as ProjectTier, projects$1_ProjectToken as ProjectToken, projects$1_ProjectType as ProjectType, projects$1_ProjectsEndpoints as ProjectsEndpoints, projects$1_QuotaOverrides as QuotaOverrides, projects$1_QuotaUsage as QuotaUsage, projects$1_Secret as Secret, projects$1_Webhook as Webhook, }; } /** * All endpoints for Hop's Docker registry * @public */ type RegistryEndpoints = Endpoint<'DELETE', '/v1/registry/images/:image', Empty> | Endpoint<'GET', '/v1/registry/images', { images: string[]; }> | Endpoint<'GET', '/v1/registry/images/:image/manifests', { manifests: { digest: { digest: string; size: number; uploaded: string; }; tag: string | null; }[]; }>; type registry$1_RegistryEndpoints = RegistryEndpoints; declare namespace registry$1 { export { registry$1_RegistryEndpoints as RegistryEndpoints, }; } /** * Fleet scheduling state (schedulable/unschedulable) */ declare enum FleetSchedulingState { SCHEDULABLE = "schedulable", UNSCHEDULABLE = "unschedulable" } /** * Fleet status (online/offline) */ declare enum FleetStatus { ONLINE = "online", OFFLINE = "offline" } /** * Fleet node */ interface Node { /** * Node ID * * @example "fleet_node_xxx" */ id: Id<'fleet_node'>; /** * Project ID containing the node * * @example "project_xxx" */ project_id: Id<'project'>; /** * Fleet group ID containing the node * * @example "fleet_group_xxx" */ fleet_group: Id<'fleet_group'> | null; /** * Node name shown in the dashboard */ name: string; /** * Scheduling state of the node (schedulable/unschedulable) */ scheduling_state: FleetSchedulingState; /** * Status of the node (online/offline) */ status: FleetStatus; /** * The last time the node sent a heartbeat (Used to determine if the node is alive) */ last_heartbeat: Timestamp; /** * Node metadata */ metadata: NodeMetadata | null; /** * Whether if the node is bootstrapped and initialized */ bootstrapped: boolean; /** * When the node was created */ created_at: Timestamp; } interface NodeMetadata { /** * The node's public IP addresses (includes IPv4 and IPv6) */ public_ips: NodeIP[]; /** * The country the node is located in */ country: string; /** * The hostname of the node */ hostname: string; /** * The node's architecture * * @example "x86_64" */ arch: string; /** * The node's operating system version */ os: string; /** * The engine used to run deployments on the node * * @example "podman" */ engine: 'podman'; } interface NodeIP { /** * IP Address */ ip: string; /** * IP Address Type */ type: 'ipv4' | 'ipv6'; } type TargetID = Id<'fleet_node'> | Id<'fleet_group'> | null; type FleetEndpoints = Endpoint<'GET', '/v1/fleet/nodes', { nodes: Node[]; }> | Endpoint<'POST', '/v1/fleet/nodes', { node: Node; token: string; }, { name: string; scheduling_state: FleetSchedulingState; }> | Endpoint<'POST', '/v1/fleet/nodes/:node_id/token', { token: string; }> | Endpoint<'DELETE', '/v1/fleet/nodes/:node_id', Empty> | Endpoint<'PATCH', '/v1/fleet/nodes/:node_id', { node: Node; }, { scheduling_state: FleetSchedulingState; }>; /** * A successful response from an API endpoint * @public */ type SuccessfulAPIResponse = { success: true; data: T; }; /** * An error response from an API endpoint * @public */ type ErroredAPIResponse = { success: false; error: { code: string; message: string; }; }; /** * The response from an API endpoint * @public */ type APIResponse = SuccessfulAPIResponse | ErroredAPIResponse; /** * A successful response from an API endpoint * @public */ type Endpoint = { method: M; path: Path; res: Res; body: Body; }; /** * A successful response from an API endpoint * @public */ type Endpoints = IgniteEndpoints | RegistryEndpoints | UserEndpoints | ProjectsEndpoints | PipeEndpoints | ChannelEndpoints | FleetEndpoints; /** * Types that a channel can be * @public */ declare enum ChannelType { PRIVATE = "private", PUBLIC = "public", UNPROTECTED = "unprotected" } /** * Generic state type of a channel * @public */ type AnyStateObject = Record; /** * @deprecated Use {@link AnyStateObject} instead * @public */ type State = AnyStateObject; /** * Definition of a channel * @public */ interface Channel { /** * The ID of the channel */ id: string; /** * The project it is associated with */ project: Project; /** * State metadata */ state: AnyStateObject; /** * Capabilities of the channel */ capabilities: number; /** * When this channel was created */ created_at: Timestamp; /** * The type of this channel */ type: ChannelType; } /** * A token for a channel * @public */ interface ChannelToken { /** * The ID for the token */ id: Id<'leap_token'>; /** * State for this token */ state: AnyStateObject; /** * The project this channel token is associated with */ project_id: Id<'project'>; /** * If this token is currently online (e.g. active heartbeat and connected to leap) */ is_online: boolean; } /** * Endpoints for channels * @public */ type ChannelEndpoints = Endpoint<'POST', '/v1/channels', { channel: Channel; }, { type: ChannelType; state: Record | null; }> | Endpoint<'PUT', '/v1/channels/:channel_id', { channel: Channel; }, { type: ChannelType; state: Record | null; }> | Endpoint<'POST', '/v1/channels/tokens', { token: ChannelToken; }, { state: AnyStateObject; }> | Endpoint<'DELETE', '/v1/channels/:channel_id', Empty> | Endpoint<'GET', '/v1/channels/:channel_id', { channel: Channel; }> | Endpoint<'GET', '/v1/channels/:channel_id/tokens', { tokens: ChannelToken[]; }> | Endpoint<'POST', '/v1/channels/tokens/:token/messages', Empty, { e: string; d: unknown; }> | Endpoint<'PUT', '/v1/channels/:channel_id/subscribers/:token', Empty> | Endpoint<'DELETE', '/v1/channels/:channel_id/subscribers/:token', Empty> | Endpoint<'PATCH', '/v1/channels/:channel_id/state', Empty, AnyStateObject> | Endpoint<'PUT', '/v1/channels/:channel_id/state', Empty, AnyStateObject> | Endpoint<'GET', '/v1/channels/:channel_id/state', { state: AnyStateObject; }> | Endpoint<'POST', '/v1/channels/:channel_id/messages', Empty, { e: string; d: unknown; }> | Endpoint<'GET', '/v1/channels', { channels: Channel[]; }> | Endpoint<'GET', '/v1/channels/tokens/:token', { token: ChannelToken; }> | Endpoint<'PATCH', '/v1/channels/tokens/:token', { token: ChannelToken; }, { expiresAt?: Timestamp | null; state: ChannelToken['state']; }> | Endpoint<'DELETE', '/v1/channels/tokens/:token', Empty> | Endpoint<'GET', '/v1/channels/:channel_id/stats', { stats: { online_count: number; }; }>; type channels$1_AnyStateObject = AnyStateObject; type channels$1_Channel = Channel; type channels$1_ChannelEndpoints = ChannelEndpoints; type channels$1_ChannelToken = ChannelToken; type channels$1_ChannelType = ChannelType; declare const channels$1_ChannelType: typeof ChannelType; type channels$1_State = State; declare namespace channels$1 { export { channels$1_AnyStateObject as AnyStateObject, channels$1_Channel as Channel, channels$1_ChannelEndpoints as ChannelEndpoints, channels$1_ChannelToken as ChannelToken, channels$1_ChannelType as ChannelType, channels$1_State as State, }; } declare namespace api { export { channels$1 as Channels, ignite$1 as Ignite, pipe$1 as Pipe, projects$1 as Projects, registry$1 as Registry, users$1 as Users, }; } /** * A valid ID prefix supported by the Hop API for authetication * @public */ type APIAuthenticationPrefix = 'ptk' | 'bearer' | 'pat'; /** * Extract an endpoint from a given method and path * @public */ type ExtractEndpoint = Extract; /** * Pull all paths for a given method * @internal */ type PathsFor = Extract['path']; /** * All possible authentication ID types * @public */ type APIAuthentication = Id; /** * Validates that an authentication prefix is valid * @param auth - The prefix to validate * @returns `true` if the prefix is valid, `false` otherwise * @public */ declare function validateAPIAuthentication(auth: string): auth is APIAuthenticationPrefix; /** * Options passed to the API client. * This will usually come from Hop#constructor in most cases * @public */ interface APIClientOptions { readonly baseUrl: string; readonly authentication: APIAuthentication; } /** * An error that occurred as a response from the Hop API. * @public */ declare class HopAPIError extends Error { readonly request: Request; readonly response: Response; readonly data: ErroredAPIResponse; readonly status: number; constructor(request: Request, response: Response, data: ErroredAPIResponse); } /** * Generate a query object that includes typed URL params * @public */ type Query = ExtractRouteParams & Record; /** * API Client that is responsible for handling all requests * @public */ declare class APIClient { static getAuthType(auth: APIAuthentication): APIAuthenticationPrefix; private readonly options; private agent; readonly authType: APIAuthenticationPrefix; readonly url: (path: Path, query: Query) => string; constructor(options: APIClientOptions); get>(path: Path, query: Query, init?: RequestInit): Promise<(Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract; leap_token: string | null; }>, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract | null>>, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }> | Extract, { path: Path; method: 'GET'; }>)["res"]>; post['path']>(path: Path, body: Extract['body'], query: Query, init?: RequestInit): Promise<(Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract>, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract | null; }>, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }> | Extract, { path: Path; method: 'POST'; }>)["res"]>; put['path']>(path: Path, body: Extract['body'], query: Query, init?: RequestInit): Promise<(Extract, { path: Path; method: 'PUT'; }> | Extract, { path: Path; method: 'PUT'; }> | Extract, { path: Path; method: 'PUT'; }> | Extract, { path: Path; method: 'PUT'; }> | Extract | null; }>, { path: Path; method: 'PUT'; }> | Extract, { path: Path; method: 'PUT'; }> | Extract, { path: Path; method: 'PUT'; }>)["res"]>; patch['path']>(path: Path, body: Extract['body'], query: Query, init?: RequestInit): Promise<(Extract, { path: Path; method: 'PATCH'; }> | Extract>, { path: Path; method: 'PATCH'; }> | Extract>, { path: Path; method: 'PATCH'; }> | Extract>>, { path: Path; method: 'PATCH'; }> | Extract, { path: Path; method: 'PATCH'; }> | Extract, { path: Path; method: 'PATCH'; }> | Extract, { path: Path; method: 'PATCH'; }> | Extract, { path: Path; method: 'PATCH'; }> | Extract, { path: Path; method: 'PATCH'; }>)["res"]>; delete['path']>(path: Path, body: Extract['body'], query: Query, init?: RequestInit): Promise<(Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }> | Extract, { path: Path; method: 'DELETE'; }>)["res"]>; raw(request: Request): Promise; private executeRequest; private request; } /** * New state to set to a channel, or a callback function that will produce the new state * @public */ type SetStateAction = T | ((oldState: T) => T | Promise); /** * Channels SDK client * @public */ declare const channels: (client: APIClient) => { /** * Creates a new channel * * @param type - The type of the channel to create * @param id - An ID to assign to the channel (optional, set this to `undefined` or `null` if you do not want to specify an ID) * @param project - A project ID (if necessary) to assign this to */ create(type: ChannelType, id?: string | null, options?: { state?: T; } | null | undefined, project?: Id<'project'>): Promise(state: SetStateAction): Promise; patchState(state: SetStateAction): Promise; subscribeToken(token: Id<'leap_token'>): Promise; subscribeTokens(tokens: Id<'leap_token'>[] | Set>): Promise; removeToken(token: Id<'leap_token'>): Promise; publishMessage(name: string, data: unknown): Promise; }>; get(id: string): Promise(state: SetStateAction): Promise; patchState(state: SetStateAction): Promise; subscribeToken(token: Id<'leap_token'>): Promise; subscribeTokens(tokens: Id<'leap_token'>[] | Set>): Promise; removeToken(token: Id<'leap_token'>): Promise; publishMessage(name: string, data: unknown): Promise; }>; /** * Get all channels for a project * * @param project - An optional project ID if authenticating with a PAT or Bearer */ getAll(project?: Id<'project'>): Promise<(Channel & { setState(state: SetStateAction): Promise; patchState(state: SetStateAction): Promise; subscribeToken(token: Id<'leap_token'>): Promise; subscribeTokens(tokens: Id<'leap_token'>[] | Set>): Promise; removeToken(token: Id<'leap_token'>): Promise; publishMessage(name: string, data: unknown): Promise; })[]>; subscribeToken(channel: string | Channel, token: Id<'leap_token'>): Promise; removeToken(channel: string | Channel, token: Id<'leap_token'>): Promise; subscribeTokens(channel: string | Channel, tokens: Iterable>): Promise; removeTokens(channel: string | Channel, tokens: Iterable>): Promise; getAllTokens(channel: string | Channel): Promise; setState(channel: string | Channel, state: SetStateAction): Promise; patchState(channel: string | Channel, state: SetStateAction): Promise; /** * Publishes a new event to a channel * * @param channel - The channel to publish to * @param event - The event name * @param data - The data for this event */ publishMessage(channel: string | Channel, event: string, data: T_5): Promise; delete(id: string): Promise; getStats(id: string): Promise<{ online_count: number; }>; tokens: { delete(token: Id<'leap_token'>): Promise; /** * Creates a new channel token for a project * * @param state - The state to set on the token * @param project - The project to attach this token to */ create(state?: AnyStateObject, project?: Id<'project'>): Promise; setState(id: Id<'leap_token'>, state: AnyStateObject): Promise; get(id: Id<'leap_token'>): Promise; isOnline(idOrToken: `leap_token_${string}` | ChannelToken): Promise; /** * Publishes a direct message to a single token * @param token - The token to publish a direct message to * @param event - The event name * @param data - The data for this event */ publishDirectMessage(token: Id<'leap_token'>, event: string, data: T_6): Promise; }; }; /** * Partial options for the Hop client * @public */ type PartialAPIOptions = Partial> & Pick; /** * Root class containing all methods and types for interacting with the Hop platform. * This will be the entrypoint for most users of the Hop SDK. * * @public * * @example * ```ts * const hop = new Hop(bearerTokenOrPATOrProjectToken); * await hop.ignite.containers.create(deploymentId); * ``` */ declare class Hop { readonly client: APIClient; readonly ignite: { groups: { create(name: string, options?: Partial<{ deploymentIds: `deployment_${string}`[]; position: number; }> | undefined, projectId?: `project_${string}` | undefined): Promise; edit(groupId: `deployment_group_${string}`, { name, position, }: { name?: string | undefined; position?: number | undefined; }, projectId?: `project_${string}` | undefined): Promise; move(deploymentId: `deployment_${string}`, groupId: `deployment_group_${string}` | null, projectId?: `project_${string}` | undefined): Promise; delete(groupId: `deployment_group_${string}`, projectId?: `project_${string}` | undefined): Promise; }; domains: { delete: (id: `domain_${string}`) => Promise; get: (id: `domain_${string}`) => Promise; }; gateways: { addDomain(gatewayId: `gateway_${string}`, domain: string): Promise; get(gatewayId: `gateway_${string}`): Promise; getAll(deploymentId: `deployment_${string}`): Promise<(Gateway & { addDomain(domain: string): Promise; deleteDomain(domainId: `domain_${string}`): Promise; })[]>; create(deployment: `deployment_${string}` | Deployment, config: { type: GatewayType.EXTERNAL; protocol: "http" | null; targetPort: number; name: string; } | { type: GatewayType.INTERNAL; protocol: "http" | null; targetPort: number; name: string; internalDomain: string; }): Promise; deleteDomain(domainId: `domain_${string}`): Promise; }>; }; healthChecks: { create: (deployment: `deployment_${string}`, config: Omit) => Promise; update: (deployment: `deployment_${string}`, config: Partial>) => Promise; }; deployments: { create: { (configOrProject: `project_${string}`, bearerOrPatConfig: CreateDeploymentConfig): Promise; delete(): Promise; createContainer(): Promise; createGateway(config: { type: GatewayType.EXTERNAL; protocol: "http" | null; name: string; targetPort: number; } | { type: GatewayType.INTERNAL; protocol: "http" | null; name: string; targetPort: number; internalDomain: string; }): Promise; deleteDomain(domainId: `domain_${string}`): Promise; }>; getStorageStats(): Promise | null>>; }>; (configOrProject: CreateDeploymentConfig): Promise; delete(): Promise; createContainer(): Promise; createGateway(config: { type: GatewayType.EXTERNAL; protocol: "http" | null; name: string; targetPort: number; } | { type: GatewayType.INTERNAL; protocol: "http" | null; name: string; targetPort: number; internalDomain: string; }): Promise; deleteDomain(domainId: `domain_${string}`): Promise; }>; getStorageStats(): Promise | null>>; }>; }; get: { (name: string, projectId?: `project_${string}` | undefined): Promise; delete(): Promise; createContainer(): Promise; createGateway(config: { type: GatewayType.EXTERNAL; protocol: "http" | null; name: string; targetPort: number; } | { type: GatewayType.INTERNAL; protocol: "http" | null; name: string; targetPort: number; internalDomain: string; }): Promise; deleteDomain(domainId: `domain_${string}`): Promise; }>; getStorageStats(): Promise | null>>; }>; (id: `deployment_${string}`, projectId?: `project_${string}` | undefined): Promise; delete(): Promise; createContainer(): Promise; createGateway(config: { type: GatewayType.EXTERNAL; protocol: "http" | null; name: string; targetPort: number; } | { type: GatewayType.INTERNAL; protocol: "http" | null; name: string; targetPort: number; internalDomain: string; }): Promise; deleteDomain(domainId: `domain_${string}`): Promise; }>; getStorageStats(): Promise | null>>; }>; }; rollout(id: `deployment_${string}`): Promise; getStorageStats(id: `deployment_${string}`): Promise | null>>; update(deploymentId: `deployment_${string}`, config: Partial): Promise; getContainers(deployment: `deployment_${string}`): Promise; getAll(projectId?: `project_${string}` | undefined): Promise<{ deployments: (Deployment & { getContainers(): Promise; delete(): Promise; createContainer(): Promise; createGateway(config: { type: GatewayType.EXTERNAL; protocol: "http" | null; name: string; targetPort: number; } | { type: GatewayType.INTERNAL; protocol: "http" | null; name: string; targetPort: number; internalDomain: string; }): Promise; deleteDomain(domainId: `domain_${string}`): Promise; }>; getStorageStats(): Promise | null>>; })[]; groups: Group[]; }>; delete(deployment: `deployment_${string}`): Promise; patchMetadata(deploymentId: `deployment_${string}`, metadata: Partial): Promise; }; containers: { delete: { (container_id: `container_${string}`, options: { recreate: true; }): Promise; (container_id: `container_${string}`, options?: { recreate?: false; } | undefined): Promise; }; getLogs(container: `container_${string}`, options?: Partial<{ sortBy: "timestamp"; orderBy: "desc" | "asc"; limit: number; offset: number; }>): Promise; stop(container: `container_${string}`): Promise; start(container: `container_${string}`): Promise; create(deployment: `deployment_${string}`): Promise; }; }; readonly users: { me: { get(): Promise<{ projects: Project[]; user: SelfUser; project_member_role_map: Record<`project_${string}`, MemberRole>; leap_token: string | null; }>; pats: { create(name: string): Promise; getAll(): Promise; delete(id: `pat_${string}`): Promise; }; }; }; readonly projects: { getAllMembers(projectId?: `project_${string}` | undefined): Promise; getCurrentMember(projectId: `project_${string}`): Promise; projectTokens: { delete(projectTokenId: `ptkid_${string}`, project?: `project_${string}` | undefined): Promise; get(projectId?: `project_${string}` | undefined): Promise; create(flags: number, projectId?: `project_${string}` | undefined): Promise; }; tokens: { delete(projectTokenId: `ptkid_${string}`, project?: `project_${string}` | undefined): Promise; get(projectId?: `project_${string}` | undefined): Promise; create(flags: number, projectId?: `project_${string}` | undefined): Promise; }; webhooks: { constructEvent: typeof constructEvent; getAll(projectId?: `project_${string}` | undefined): Promise; create(webhook_url: string, events: ("ignite.deployment.created" | "ignite.deployment.updated" | "ignite.deployment.deleted" | "ignite.deployment.build.created" | "ignite.deployment.build.started" | "ignite.deployment.build.updated" | "ignite.deployment.build.completed" | "ignite.deployment.build.failed" | "ignite.deployment.build.cancelled" | "ignite.deployment.rollout.created" | "ignite.deployment.rollout.updated" | "ignite.deployment.container.created" | "ignite.deployment.container.updated" | "ignite.deployment.container.metrics_update" | "ignite.deployment.container.deleted" | "ignite.deployment.healthcheck.created" | "ignite.deployment.healthcheck.updated" | "ignite.deployment.healthcheck.deleted" | "ignite.deployment.healthcheck.events.failed" | "ignite.deployment.healthcheck.events.succeeded" | "ignite.deployment.gateway.created" | "ignite.deployment.gateway.updated" | "ignite.deployment.gateway.deleted" | "project.updated" | "project.member.created" | "project.member.updated" | "project.member.deleted" | "project.tokens.created" | "project.tokens.deleted" | "project.secrets.created" | "project.secrets.updated" | "project.secrets.deleted" | "project.finance.transaction")[], projectId?: `project_${string}` | undefined): Promise; edit(webhookId: `webhook_${string}`, { events, webhookUrl, }: { webhookUrl?: string | undefined; events?: ("ignite.deployment.created" | "ignite.deployment.updated" | "ignite.deployment.deleted" | "ignite.deployment.build.created" | "ignite.deployment.build.started" | "ignite.deployment.build.updated" | "ignite.deployment.build.completed" | "ignite.deployment.build.failed" | "ignite.deployment.build.cancelled" | "ignite.deployment.rollout.created" | "ignite.deployment.rollout.updated" | "ignite.deployment.container.created" | "ignite.deployment.container.updated" | "ignite.deployment.container.metrics_update" | "ignite.deployment.container.deleted" | "ignite.deployment.healthcheck.created" | "ignite.deployment.healthcheck.updated" | "ignite.deployment.healthcheck.deleted" | "ignite.deployment.healthcheck.events.failed" | "ignite.deployment.healthcheck.events.succeeded" | "ignite.deployment.gateway.created" | "ignite.deployment.gateway.updated" | "ignite.deployment.gateway.deleted" | "project.updated" | "project.member.created" | "project.member.updated" | "project.member.deleted" | "project.tokens.created" | "project.tokens.deleted" | "project.secrets.created" | "project.secrets.updated" | "project.secrets.deleted" | "project.finance.transaction")[] | undefined; }, projectId?: `project_${string}` | undefined): Promise; delete(webhookId: `webhook_${string}`, projectId?: `project_${string}` | undefined): Promise; regenerateSecret(webhookId: `webhook_${string}`, projectId?: `project_${string}` | undefined): Promise; }; secrets: { getAll(projectId?: `project_${string}` | undefined): Promise; create(name: string, value: string, projectId?: `project_${string}` | undefined): Promise; delete(id: string, projectId?: `project_${string}` | undefined): Promise; }; }; readonly pipe: { rooms: { getAll(project?: `project_${string}` | undefined): Promise<(Room & { delete(): Promise; })[]>; create(name: string, options: { deliveryProtocols: DeliveryProtocol[]; ephemeral?: boolean; ingestProtocol: "rtmp" | "rtp"; hlsConfig?: { wcl_delay: number; artificial_delay: number; max_playout_bitrate_preset: string; }; }): Promise; }>; delete(room: `pipe_room_${string}`): Promise; }; }; readonly registry: { images: { getAll(project?: `project_${string}` | undefined): Promise; getManifest(image: string, project?: `project_${string}` | undefined): Promise<{ digest: { digest: string; size: number; uploaded: string; }; tag: string | null; }[]>; delete(image: string, project?: `project_${string}` | undefined): Promise; }; }; readonly channels: { create(type: ChannelType, id?: string | null | undefined, options?: { state?: T; } | null | undefined, project?: `project_${string}` | undefined): Promise(state: SetStateAction): Promise; patchState(state: SetStateAction): Promise; subscribeToken(token: `leap_token_${string}`): Promise; subscribeTokens(tokens: `leap_token_${string}`[] | Set<`leap_token_${string}`>): Promise; removeToken(token: `leap_token_${string}`): Promise; publishMessage(name: string, data: unknown): Promise; }>; get(id: string): Promise(state: SetStateAction): Promise; patchState(state: SetStateAction): Promise; subscribeToken(token: `leap_token_${string}`): Promise; subscribeTokens(tokens: `leap_token_${string}`[] | Set<`leap_token_${string}`>): Promise; removeToken(token: `leap_token_${string}`): Promise; publishMessage(name: string, data: unknown): Promise; }>; getAll(project?: `project_${string}` | undefined): Promise<(Channel & { setState(state: SetStateAction): Promise; patchState(state: SetStateAction): Promise; subscribeToken(token: `leap_token_${string}`): Promise; subscribeTokens(tokens: `leap_token_${string}`[] | Set<`leap_token_${string}`>): Promise; removeToken(token: `leap_token_${string}`): Promise; publishMessage(name: string, data: unknown): Promise; })[]>; subscribeToken(channel: string | Channel, token: `leap_token_${string}`): Promise; removeToken(channel: string | Channel, token: `leap_token_${string}`): Promise; subscribeTokens(channel: string | Channel, tokens: Iterable<`leap_token_${string}`>): Promise; removeTokens(channel: string | Channel, tokens: Iterable<`leap_token_${string}`>): Promise; getAllTokens(channel: string | Channel): Promise; setState(channel: string | Channel, state: SetStateAction): Promise; patchState(channel: string | Channel, state: SetStateAction): Promise; publishMessage(channel: string | Channel, event: string, data: T_5): Promise; delete(id: string): Promise; getStats(id: string): Promise<{ online_count: number; }>; tokens: { delete(token: `leap_token_${string}`): Promise; create(state?: AnyStateObject, project?: `project_${string}` | undefined): Promise; setState(id: `leap_token_${string}`, state: AnyStateObject): Promise; get(id: `leap_token_${string}`): Promise; isOnline(idOrToken: `leap_token_${string}` | ChannelToken): Promise; publishDirectMessage(token: `leap_token_${string}`, event: string, data: T_6): Promise; }; }; readonly fleet: { getNodes(projectId?: `project_${string}` | undefined): Promise<(Node & { deleteNode(): Promise; editNode(data: { schedulingState: FleetSchedulingState; }): Promise; /** * Root class containing all methods and types for interacting with the Hop platform. * This will be the entrypoint for most users of the Hop SDK. * * @public * * @example * ```ts * const hop = new Hop(bearerTokenOrPATOrProjectToken); * await hop.ignite.containers.create(deploymentId); * ``` */ regenerateToken(): Promise; })[]>; createNode(name: string, schedulingState: FleetSchedulingState, projectId?: `project_${string}` | undefined): Promise<{ node: Node & { deleteNode(): Promise; editNode(data: { schedulingState: FleetSchedulingState; }): Promise; /** * Root class containing all methods and types for interacting with the Hop platform. * This will be the entrypoint for most users of the Hop SDK. * * @public * * @example * ```ts * const hop = new Hop(bearerTokenOrPATOrProjectToken); * await hop.ignite.containers.create(deploymentId); * ``` */ regenerateToken(): Promise; }; token: string; }>; regenerateToken(nodeId: `fleet_node_${string}`, projectId: `project_${string}`): Promise; editNode(nodeId: `fleet_node_${string}`, data: { schedulingState: FleetSchedulingState; }, projectId?: `project_${string}` | undefined): Promise; deleteNode(nodeId: `fleet_node_${string}`, projectId?: `project_${string}` | undefined): Promise; }; constructor(options: PartialAPIOptions); constructor(authentication: APIAuthentication, baseurl?: string); } /** * A list of all permissions and their representative names * @public */ declare enum PROJECT_PERMISSION { ADD_MEMBER = "add_member", REMOVE_MEMBER = "remove_member", GET_PROJECT_MEMBERS = "get_project_members", DELETE_PROJECT = "delete_project", DELETE_DEPLOYMENT = "delete_deployment", DELETE_CONTAINER = "delete_container", UPDATE_CONTAINER_STATE = "update_container_state", READ_DEPLOYMENTS = "read_deployments", CREATE_DEPLOYMENT = "create_deployment", CREATE_CONTAINER = "create_container", UPDATE_CONTAINER_CONFIG = "update_container_config", CREATE_ROOM = "create_room", READ_ROOM = "read_room", DELETE_ROOM = "delete_room", CREATE_ROOM_PRODUCER = "create_room_producer", CREATE_PROJECT_TOKEN = "create_project_token", DELETE_PROJECT_TOKEN = "delete_project_token", READ_PROJECT_TOKENS = "read_project_tokens", READ_CONTAINER_LOGS = "read_container_logs", CREATE_PROJECT_SECRET = "create_project_secret", READ_PROJECT_SECRETS = "read_project_secrets", DELETE_PROJECT_SECRET = "delete_project_secret", GET_REGISTRY_IMAGES = "get_registry_images", CREATE_CHANNEL = "create_channel", CREATE_CHANNEL_TOKEN = "create_channel_token", CREATE_LEAP_TOKEN = "create_leap_token", CREATE_GATEWAY = "create_gateway", ADD_DOMAIN = "add_domain", DELETE_CHANNELS = "delete_channels", UPDATE_CHANNEL_STATE = "update_channel_state", PUBLISH_CHANNEL_MESSAGES = "publish_channel_messages", READ_CHANNELS = "read_channels", READ_LEAP_TOKENS = "read_leap_tokens", MANAGE_CHANNEL_SUBSCRIBERS = "manage_channel_subscribers", UPDATE_LEAP_TOKEN = "update_leap_token", DELETE_DOMAIN = "delete_domain", DELETE_GATEWAY = "delete_gateway", GET_INTERNAL_DOMAIN = "get_internal_domain", MESSAGE_TOKEN = "message_token", ROLLOUT = "rollout", REQUEST_QUOTA_INCREASE = "request_quota_increase", READ_BILLING = "read_billing", READ_GATEWAYS = "read_gateways", DELETE_REGISTRY_IMAGES = "delete_registry_images", CONTAINER_SSH = "container_ssh", TUNNEL_DEPLOYMENT = "tunnel_deployment", CREATE_WEBHOOK = "create_webhook", DELETE_WEBHOOK = "delete_webhook", UPDATE_WEBHOOK = "update_webhook", READ_WEBHOOKS = "read_webhooks" } /** * Individual bitwise permissions * @public */ declare const permissionsMap: { add_member: bigint; remove_member: bigint; get_project_members: bigint; delete_project: bigint; delete_deployment: bigint; delete_container: bigint; update_container_state: bigint; read_deployments: bigint; create_deployment: bigint; create_container: bigint; update_container_config: bigint; create_room: bigint; read_room: bigint; delete_room: bigint; create_room_producer: bigint; create_project_token: bigint; delete_project_token: bigint; read_project_tokens: bigint; read_container_logs: bigint; create_project_secret: bigint; read_project_secrets: bigint; delete_project_secret: bigint; get_registry_images: bigint; create_channel_token: bigint; create_gateway: bigint; add_domain: bigint; delete_channels: bigint; update_channel_state: bigint; read_channels: bigint; publish_channel_messages: bigint; manage_channel_subscribers: bigint; delete_domain: bigint; delete_gateway: bigint; get_internal_domain: bigint; create_leap_token: bigint; read_leap_tokens: bigint; update_leap_token: bigint; message_token: bigint; create_channel: bigint; rollout: bigint; request_quota_increase: bigint; read_billing: bigint; read_gateways: bigint; delete_registry_images: bigint; container_ssh: bigint; tunnel_deployment: bigint; create_webhook: bigint; delete_webhook: bigint; update_webhook: bigint; read_webhooks: bigint; }; /** * Broader permission map * @public */ declare const BROAD_PERMISSIONS_MAP: { MANAGE_MEMBERS: bigint; MANAGE_PROJECT_TOKENS: bigint; MANAGE_DEPLOYMENTS: bigint; MANAGE_PIPE: bigint; MANAGE_SECRETS: bigint; MANAGE_CHANNELS: bigint; MANAGE_REGISTRY: bigint; READ_ONLY: bigint; MANAGE_QUOTAS: bigint; MANAGE_ROLLOUTS: bigint; MANAGE_BILLING: bigint; MANAGE_WEBHOOKS: bigint; }; /** * Bitwise role flags that a user can be as part of a project * @public */ declare const roles: { viewer: bigint; editor: bigint; owner: bigint; }; /** * Permission utility functions * @public */ declare const permissions: { add(value: bigint, flag: bigint): bigint; test(value: bigint, flag: bigint): boolean; subtract(value: bigint, flag: bigint): bigint; }; /** * Ignite SDK client * @public */ declare const ignite: (client: APIClient) => { groups: { create(name: string, options?: Partial<{ deploymentIds: Id<'deployment'>[]; position: number; }>, projectId?: Id<'project'>): Promise; edit(groupId: Id<'deployment_group'>, { name, position, }: { name?: string | undefined; position?: number | undefined; }, projectId?: Id<'project'>): Promise; /** * Moves a deployment to a group, or removes it if groupId is null */ move(deploymentId: Id<'deployment'>, groupId: Id<'deployment_group'> | null, projectId?: Id<'project'>): Promise; delete(groupId: Id<'deployment_group'>, projectId?: Id<'project'>): Promise; }; domains: { delete: (id: Id<'domain'>) => Promise; get: (id: Id<'domain'>) => Promise; }; gateways: { /** * Adds a domain to a gateway * * @param gatewayId - The ID of the gateway * @param domain - The full name of the domain */ addDomain(gatewayId: Id<'gateway'>, domain: string): Promise; /** * Fetches a gateway by ID * * @param gatewayId - The ID of the gateway to retrieve */ get(gatewayId: Id<'gateway'>): Promise; /** * Fetches all gateways attached to a deployment * * @param deploymentId - The ID of the deployment to fetch gateways for */ getAll(deploymentId: Id<'deployment'>): Promise<(Gateway & { addDomain(domain: string): Promise; deleteDomain(domainId: Id<'domain'>): Promise; })[]>; /** * Creates and attaches a gateway to a deployment * * @param deployment - The deployment to create a gateway on * @param type - The type of the gateway to create, either internal or external * @param protocol - The protocol that the gateway will listen for * @param targetPort - The port to listen on */ create(deployment: Deployment | Deployment['id'], config: { type: GatewayType.EXTERNAL; protocol: Gateway['protocol']; targetPort: number; name: string; } | { type: GatewayType.INTERNAL; protocol: Gateway['protocol']; targetPort: number; name: string; internalDomain: string; }): Promise; deleteDomain(domainId: Id<'domain'>): Promise; }>; }; healthChecks: { create: (deployment: Id<'deployment'>, config: Omit) => Promise; update: (deployment: Id<'deployment'>, config: Partial>) => Promise; }; deployments: { create: { (configOrProject: Id<'project'>, bearerOrPatConfig: CreateDeploymentConfig): Promise; delete(): Promise; createContainer(): Promise; createGateway(config: { type: GatewayType.EXTERNAL; protocol: Gateway['protocol']; name: string; targetPort: number; } | { type: GatewayType.INTERNAL; protocol: Gateway['protocol']; name: string; targetPort: number; internalDomain: string; }): Promise; deleteDomain(domainId: Id<'domain'>): Promise; }>; getStorageStats(): Promise | null>>; }>; (configOrProject: CreateDeploymentConfig): Promise; delete(): Promise; createContainer(): Promise; createGateway(config: { type: GatewayType.EXTERNAL; protocol: Gateway['protocol']; name: string; targetPort: number; } | { type: GatewayType.INTERNAL; protocol: Gateway['protocol']; name: string; targetPort: number; internalDomain: string; }): Promise; deleteDomain(domainId: Id<'domain'>): Promise; }>; getStorageStats(): Promise | null>>; }>; }; get: { (name: string, projectId?: Id<'project'>): Promise; delete(): Promise; createContainer(): Promise; createGateway(config: { type: GatewayType.EXTERNAL; protocol: Gateway['protocol']; name: string; targetPort: number; } | { type: GatewayType.INTERNAL; protocol: Gateway['protocol']; name: string; targetPort: number; internalDomain: string; }): Promise; deleteDomain(domainId: Id<'domain'>): Promise; }>; getStorageStats(): Promise | null>>; }>; (id: Id<'deployment'>, projectId?: Id<'project'>): Promise; delete(): Promise; createContainer(): Promise; createGateway(config: { type: GatewayType.EXTERNAL; protocol: Gateway['protocol']; name: string; targetPort: number; } | { type: GatewayType.INTERNAL; protocol: Gateway['protocol']; name: string; targetPort: number; internalDomain: string; }): Promise; deleteDomain(domainId: Id<'domain'>): Promise; }>; getStorageStats(): Promise | null>>; }>; }; rollout(id: Id<'deployment'>): Promise; getStorageStats(id: Id<'deployment'>): Promise | null>>; update(deploymentId: Id<'deployment'>, config: Partial): Promise; /** * Get all containers for a deployment * * @param deployment - The ID of the deployment to get * @returns A list of all containers for that project */ getContainers(deployment: Id<'deployment'>): Promise; /** * Gets all deployments for a project * * @param projectId - The project ID to list deployments for. You only need to provide this if you are using bearer or PAT authentication. * @returns A list of deployments for the given project. */ getAll(projectId?: Id<'project'>): Promise<{ deployments: (Deployment & { getContainers(): Promise; delete(): Promise; createContainer(): Promise; createGateway(config: { type: GatewayType.EXTERNAL; protocol: Gateway['protocol']; name: string; targetPort: number; } | { type: GatewayType.INTERNAL; protocol: Gateway['protocol']; name: string; targetPort: number; internalDomain: string; }): Promise; deleteDomain(domainId: Id<'domain'>): Promise; }>; getStorageStats(): Promise | null>>; })[]; groups: Group[]; }>; /** * Deletes a deployment * * @param deployment - The ID of the deployment */ delete(deployment: Id<'deployment'>): Promise; patchMetadata(deploymentId: Id<'deployment'>, metadata: Partial): Promise; }; containers: { delete: { (container_id: Id<'container'>, options: { recreate: true; }): Promise; (container_id: Id<'container'>, options?: { recreate?: false; }): Promise; }; /** * Get the logs for a container * * @param container - The ID of the container * @returns */ getLogs(container: Id<'container'>, options?: Partial<{ sortBy: 'timestamp'; orderBy: 'desc' | 'asc'; limit: number; offset: number; }>): Promise; /** * Stop a container * @param container - The ID of the container */ stop(container: Id<'container'>): Promise; /** * Start a container * @param container - The ID of the container */ start(container: Id<'container'>): Promise; /** * Creates a container * * @param deployment - The ID of a deployment to create a container in. * @returns The newly created container. */ create(deployment: Id<'deployment'>): Promise; }; }; /** * Pipe SDK client * @public */ declare const pipe: (client: APIClient) => { rooms: { getAll(project?: Id<'project'>): Promise<(Room & { delete(): Promise; })[]>; create(name: string, options: { deliveryProtocols: DeliveryProtocol[]; ephemeral?: boolean; ingestProtocol: 'rtmp' | 'rtp'; hlsConfig?: { wcl_delay: number; artificial_delay: number; max_playout_bitrate_preset: string; }; }): Promise; }>; /** * Deletes a Pipe room * * @param room - The ID of the Pipe room to delete. */ delete(room: Id<'pipe_room'>): Promise; }; }; /** * Projects SDK client * @public */ declare const projects: (client: APIClient) => { getAllMembers(projectId?: Id<'project'>): Promise; /** * Fetch the currently authorized member from a project. * You cannot use this route if you are authorizing with a project token as there is no user attached to it. * * @param projectId - The project ID to fetch a member from * @returns The member authorized by the SDK */ getCurrentMember(projectId: Id<'project'>): Promise; /** * @deprecated Use {@link projectsSDK.tokens} instead */ projectTokens: { /** * Deletes a project token by its ID * * @param projectTokenId - The ID of the project token to delete */ delete(projectTokenId: Id<'ptkid'>, project?: Id<'project'>): Promise; /** * Get all project tokens for a project * * @param projectId - The project to fetch secrets for * @returns An array of all secrets for the project */ get(projectId?: Id<'project'>): Promise; /** * Creates a new project token * * @param projectId - The project to create a key for * @param flags - Permissions for this flag * @returns A newly created project token */ create(flags: number, projectId?: Id<'project'>): Promise; }; tokens: { /** * Deletes a project token by its ID * * @param projectTokenId - The ID of the project token to delete */ delete(projectTokenId: Id<'ptkid'>, project?: Id<'project'>): Promise; /** * Get all project tokens for a project * * @param projectId - The project to fetch secrets for * @returns An array of all secrets for the project */ get(projectId?: Id<'project'>): Promise; /** * Creates a new project token * * @param projectId - The project to create a key for * @param flags - Permissions for this flag * @returns A newly created project token */ create(flags: number, projectId?: Id<'project'>): Promise; }; webhooks: { constructEvent: typeof constructEvent; getAll(projectId?: Id<'project'>): Promise; create(webhook_url: string, events: PossibleWebhookIDs[], projectId?: Id<'project'>): Promise; edit(webhookId: Id<'webhook'>, { events, webhookUrl, }: { webhookUrl?: string | undefined; events?: PossibleWebhookIDs[] | undefined; }, projectId?: Id<'project'>): Promise; delete(webhookId: Id<'webhook'>, projectId?: Id<'project'>): Promise; regenerateSecret(webhookId: Id<'webhook'>, projectId?: Id<'project'>): Promise; }; secrets: { /** * Gets all secrets in a project * * @param projectId - The project to fetch secrets for */ getAll(projectId?: Id<'project'>): Promise; /** * Creates a new project secret * * @param name - The name of the secret * @param value - The value of the secret * @param projectId - The project to create the secret in */ create(name: string, value: string, projectId?: Id<'project'>): Promise; /** * Deletes a secret from a project * * @param id - The secret ID to delete * @param projectId - The project to delete the secret from */ delete(id: Id<'secret'> | Secret['name'], projectId?: Id<'project'>): Promise; }; }; /** * Registry SDK client * @public */ declare const registry: (client: APIClient) => { images: { getAll(project?: Id<'project'>): Promise; getManifest(image: string, project?: Id<'project'>): Promise<{ digest: { digest: string; size: number; uploaded: string; }; tag: string | null; }[]>; delete(image: string, project?: Id<'project'>): Promise; }; }; /** * Users SDK client * @public */ declare const users: (client: APIClient) => { me: { /** * Gets the current user * * @returns The current user authorized by the SDK */ get(): Promise<{ projects: Project[]; user: SelfUser; project_member_role_map: Record<`project_${string}`, MemberRole>; leap_token: string | null; }>; pats: { /** * Creates a PAT for the current user * * @returns The created PAT */ create(name: string): Promise; /** * Fetches all PATs for this user * * @returns A list of all pats */ getAll(): Promise; /** * Deletes a pat * * @param id - The ID of the pat to delete */ delete(id: Id<'pat'>): Promise; }; }; }; declare const fleet: (client: APIClient) => { getNodes(projectId?: Id<'project'>): Promise<(Node & { deleteNode(): Promise; editNode(data: { schedulingState: FleetSchedulingState; }): Promise; regenerateToken(): Promise; })[]>; createNode(name: string, schedulingState: FleetSchedulingState, projectId?: Id<'project'>): Promise<{ node: Node & { deleteNode(): Promise; editNode(data: { schedulingState: FleetSchedulingState; }): Promise; regenerateToken(): Promise; }; token: string; }>; regenerateToken(nodeId: Id<'fleet_node'>, projectId: Id<'project'>): Promise; editNode(nodeId: Id<'fleet_node'>, data: { schedulingState: FleetSchedulingState; }, projectId?: Id<'project'>): Promise; deleteNode(nodeId: Id<'fleet_node'>, projectId?: Id<'project'>): Promise; }; type index_SetStateAction = SetStateAction; declare const index_channels: typeof channels; declare const index_fleet: typeof fleet; declare const index_ignite: typeof ignite; declare const index_pipe: typeof pipe; declare const index_projects: typeof projects; declare const index_registry: typeof registry; declare const index_users: typeof users; declare namespace index { export { index_SetStateAction as SetStateAction, index_channels as channels, index_fleet as fleet, index_ignite as ignite, index_pipe as pipe, index_projects as projects, index_registry as registry, index_users as users, }; } export { api as API, APIAuthentication, APIAuthenticationPrefix, APIClient, APIClientOptions, APIResponse, AnyId, AnyStateObject, Auth, BROAD_PERMISSIONS_MAP, Build, BuildEnvironment, BuildEnvironmentType, BuildMetaData, BuildMetadata, BuildMethod, BuildSettings, BuildState, ByteSizeString, ByteString, ByteUnit, Channel, ChannelEndpoints, ChannelToken, ChannelType, channels$1 as Channels, Container, ContainerLog, ContainerMetrics, ContainerState, ContainerStrategy, CreateDeploymentConfig, DEFAULT_BASE_URL, DefaultQuotas, DeliveryProtocol, Deployment, DeploymentConfig, DeploymentMetaData, DeploymentMetadata, DeploymentRollout, DeploymentTarget, Domain, DomainRedirect, DomainState, Empty, Endpoint, Endpoints, ErroredAPIResponse, Event, EventDataMap, ExtractEndpoint, ExtractRouteParams, FleetEndpoints, FleetSchedulingState, FleetStatus, GHRepo, Gateway, GatewayType, Group, HealthCheck, HealthCheckEventUpdate, Hop, HopAPIError, HopShDomain, ID_PREFIXES, IS_BROWSER, Id, IdPrefixes, ignite$1 as Ignite, IgniteEndpoints, Image, ImageGHRepo, InternalHopDomain, MakeOptional, Member, MemberRole, Method, NixPlan, Node, NodeIP, NodeMetadata, PAT, POSSIBLE_EVENTS, PROJECT_PERMISSION, PartialAPIOptions, PathsFor, pipe$1 as Pipe, PipeEndpoints, PossibleWebhookGroups, PossibleWebhookIDs, Project, ProjectTier, ProjectToken, ProjectType, projects$1 as Projects, ProjectsEndpoints, Query, QuotaOverrides, QuotaUsage, Regions, registry$1 as Registry, RegistryEndpoints, Resources, RestartPolicy, RolloutState, Room, RuntimeType, SUPPORTS_INTL, Secret, SelfUser, State, SuccessfulAPIResponse, Tag, TargetID, Timestamp, User, UserEndpoints, users$1 as Users, ValidationFailure, VolumeDefinition, VolumeFormat, Webhook, assertId, byteUnits, bytes, constructEvent, getIdPrefix, gigabytes, id, isValidByteString, kilobytes, megabytes, parseSize, permissions, permissionsMap, roles, index as sdks, units, validateAPIAuthentication, validateId, validateIdPrefix, verifyHmac };