UNPKG

@twilio-labs/serverless-api

Version:
61 lines (60 loc) 2.54 kB
/** @module @twilio-labs/serverless-api/dist/api */ import { TwilioServerlessApiClient } from '../client'; import { EnvironmentResource, Sid } from '../types'; /** * Checks if a string is an environment SID by checking its prefix and length * * @export * @param {string} str the string to check * @returns */ export declare function isEnvironmentSid(str: string): boolean; /** * Retrieves a specific environment using the API * * @export * @param {Sid} environmentSid the environment to retrieve * @param {Sid} serviceSid the service the environment belongs to * @param {TwilioServerlessApiClient} client API client * @returns {Promise<EnvironmentResource>} */ export declare function getEnvironment(environmentSid: Sid, serviceSid: Sid, client: TwilioServerlessApiClient): Promise<EnvironmentResource>; /** * Creates a new environment given a domain suffix * * @export * @param {string} domainSuffix the domain suffix for the environment * @param {string} serviceSid the service to create the environment for * @param {TwilioServerlessApiClient} client API client * @returns {Promise<EnvironmentResource>} */ export declare function createEnvironmentFromSuffix(domainSuffix: string, serviceSid: string, client: TwilioServerlessApiClient): Promise<EnvironmentResource>; /** * Lists all environments for a given service * * @export * @param {string} serviceSid the service that the environments belong to * @param {TwilioServerlessApiClient} client API client * @returns */ export declare function listEnvironments(serviceSid: string, client: TwilioServerlessApiClient): Promise<EnvironmentResource[]>; /** * Looks up an environment given a domain suffix. * * @export * @param {string} domainSuffix the suffix to look for * @param {string} serviceSid the service the environment belongs to * @param {TwilioServerlessApiClient} client API client * @returns {Promise<EnvironmentResource>} */ export declare function getEnvironmentFromSuffix(domainSuffix: string, serviceSid: string, client: TwilioServerlessApiClient): Promise<EnvironmentResource>; /** * Creates an environment if non with the given suffix exists * * @export * @param {string} domainSuffix the domain suffix of the environment * @param {string} serviceSid the service the environment belongs to * @param {TwilioServerlessApiClient} client API client * @returns */ export declare function createEnvironmentIfNotExists(domainSuffixOrSid: string, serviceSid: string, client: TwilioServerlessApiClient): Promise<EnvironmentResource>;