// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; /** * Functions defined by the company */ export class Deployments extends APIResource { /** * A list of function deployments. * * - Requires: `API Tier 2` */ list(functionAPIName: string, options?: RequestOptions): APIPromise { return this._client.get(path`/functions/${functionAPIName}/deployments/`, options); } /** * Create a new function deployment. */ create( functionAPIName: string, body: DeploymentCreateParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.post(path`/functions/${functionAPIName}/deployments/`, { body, ...options }); } /** * Retrieve a specific function deployment. */ retrieve( deploymentID: string, params: DeploymentRetrieveParams, options?: RequestOptions, ): APIPromise { const { function_api_name } = params; return this._client.get(path`/functions/${function_api_name}/deployments/${deploymentID}/`, options); } /** * A list of function deployment logs. * * - Requires: `API Tier 2` */ listLogs( deploymentID: string, params: DeploymentListLogsParams, options?: RequestOptions, ): APIPromise { const { function_api_name } = params; return this._client.get(path`/functions/${function_api_name}/deployments/${deploymentID}/logs/`, options); } } export interface FunctionDeployment { /** * The ID of the deployment */ id: string; /** * The creation date of the deployment */ created_at: string; /** * The last updated date of the deployment */ updated_at: string; /** * Domains that function runs from this deployment are allowed to access */ allowed_domains?: Array; /** * The code for the deployment */ code?: string; /** * The dependencies of the deployment */ dependencies?: unknown; /** * The external ID of the deployment */ external_id?: string; /** * The API name of the function that this deployment is associated with */ function_api_name?: string; /** * The ID of the function that this deployment is associated with */ function_id?: string; /** * The human friendly ID of version that this deployment is associated with */ function_version_human_friendly_id?: number; /** * The ID of the version that this deployment is associated with */ function_version_id?: string; /** * Additional, runtime-specific options for the deployment */ options?: unknown; /** * The runtime for the deployment */ runtime?: string; /** * The status of the deployment */ status?: string; } export interface DeploymentListResponse { results?: Array; } export interface DeploymentListLogsResponse { results?: Array; } export namespace DeploymentListLogsResponse { export interface Result { /** * The log message */ message: string; /** * The sequence number of the log line */ sequence_num: number; /** * The log level */ level?: string; /** * Parameters associated with the log line */ params?: unknown; /** * The log timestamp */ timestamp?: string; } } export interface DeploymentCreateParams { /** * Domains that function runs from this deployment are allowed to access */ allowed_domains?: Array; /** * The code for the deployment */ code?: string; /** * The dependencies of the deployment */ dependencies?: unknown; /** * Additional, runtime-specific options for the deployment */ options?: unknown; /** * The runtime for the deployment */ runtime?: string; } export interface DeploymentRetrieveParams { /** * The API name of the function. */ function_api_name: string; } export interface DeploymentListLogsParams { /** * The API name of the function. */ function_api_name: string; } export declare namespace Deployments { export { type FunctionDeployment as FunctionDeployment, type DeploymentListResponse as DeploymentListResponse, type DeploymentListLogsResponse as DeploymentListLogsResponse, type DeploymentCreateParams as DeploymentCreateParams, type DeploymentRetrieveParams as DeploymentRetrieveParams, type DeploymentListLogsParams as DeploymentListLogsParams, }; }