Options
All
  • Public
  • Public/Protected
  • All
Menu

Module api

Index

References

activateBuild

Re-exports activateBuild

createAssetResource

Re-exports createAssetResource

createAssetVersion

Re-exports createAssetVersion

createEnvironmentFromSuffix

Re-exports createEnvironmentFromSuffix

createEnvironmentIfNotExists

Re-exports createEnvironmentIfNotExists

createFunctionResource

Re-exports createFunctionResource

createService

Re-exports createService

deleteEnvironmentVariable

Re-exports deleteEnvironmentVariable

downloadFunctionVersion

Re-exports downloadFunctionVersion

findServiceSid

Re-exports findServiceSid

getBuild

Re-exports getBuild

getBuildStatus

Re-exports getBuildStatus

getDependencies

Re-exports getDependencies

getEnvironment

Re-exports getEnvironment

getEnvironmentFromSuffix

Re-exports getEnvironmentFromSuffix

getLog

Re-exports getLog

getOrCreateAssetResources

Re-exports getOrCreateAssetResources

getOrCreateFunctionResources

Re-exports getOrCreateFunctionResources

getService

Re-exports getService

isEnvironmentSid

Re-exports isEnvironmentSid

isFunctionSid

Re-exports isFunctionSid

listAssetResources

Re-exports listAssetResources

listBuilds

Re-exports listBuilds

listEnvironments

Re-exports listEnvironments

listFunctionResources

Re-exports listFunctionResources

listFunctionVersions

Re-exports listFunctionVersions

listLogResources

Re-exports listLogResources

listOnePageLogResources

Re-exports listOnePageLogResources

listServices

Re-exports listServices

listVariablesForEnvironment

Re-exports listVariablesForEnvironment

removeEnvironmentVariables

Re-exports removeEnvironmentVariables

setEnvironmentVariables

Re-exports setEnvironmentVariables

triggerBuild

Re-exports triggerBuild

uploadAsset

Re-exports uploadAsset

uploadFunction

Re-exports uploadFunction

waitForSuccessfulBuild

Re-exports waitForSuccessfulBuild

Functions

activateBuild

  • activateBuild(buildSid: string, environmentSid: string, serviceSid: string, client: TwilioServerlessApiClient): Promise<any>
  • Activates a specific build for a given environment by creating a new deployment

    export

    Parameters

    • buildSid: string

      the build to be activated

    • environmentSid: string

      the target environment for the build to be deployed to

    • serviceSid: string

      the service of the project

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<any>

createAssetResource

  • Calls the API to create a new Asset Resource

    Parameters

    • name: string

      friendly name of the resource

    • serviceSid: string

      service to register asset under

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<AssetApiResource>

createAssetVersion

  • Given an asset it will create a new version instance for it

    Parameters

    Returns Promise<VersionResource>

createEnvironmentFromSuffix

  • Creates a new environment given a domain suffix

    export

    Parameters

    • domainSuffix: string

      the domain suffix for the environment

    • serviceSid: string

      the service to create the environment for

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<EnvironmentResource>

createEnvironmentIfNotExists

  • Creates an environment if non with the given suffix exists

    export

    Parameters

    • domainSuffixOrSid: string
    • serviceSid: string

      the service the environment belongs to

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<EnvironmentResource>

createFunctionResource

  • Creates a new Function instance by calling the API

    Parameters

    • name: string

      the friendly name of the function to create

    • serviceSid: string

      the service the function should belong to

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<FunctionApiResource>

createService

  • Creates a new service given a service name

    export

    Parameters

    Returns Promise<string>

deleteEnvironmentVariable

  • deleteEnvironmentVariable(variableSid: string, environmentSid: string, serviceSid: string, client: TwilioServerlessApiClient): Promise<boolean>
  • Deletes a given variable from a given environment

    export

    Parameters

    • variableSid: string

      the SID of the variable to delete

    • environmentSid: string

      the environment the variable belongs to

    • serviceSid: string

      the service the environment belongs to

    • client: TwilioServerlessApiClient

      API client instance

    Returns Promise<boolean>

downloadFunctionVersion

findServiceSid

  • Tries to find the service SID associated to a service name

    export

    Parameters

    Returns Promise<string | undefined>

getBuild

  • Retrieves a specific build by its SID

    export

    Parameters

    • buildSid: string

      SID of build to retrieve

    • serviceSid: string

      service to retrieve build from

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<BuildResource>

getBuildStatus

  • Returns the current status of a build given its SID

    Parameters

    • buildSid: string

      the SID of the build

    • serviceSid: string

      the SID of the service the build belongs to

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<BuildStatus>

getDependencies

  • getDependencies(pkgJson: PackageJson): Dependency[]
  • Creates a list of dependencies compatible with the Serverless API givn a package.json file

    export

    Parameters

    • pkgJson: PackageJson

      an object structured like a package.json

    Returns Dependency[]

getEnvironment

  • Retrieves a specific environment using the API

    export

    Parameters

    Returns Promise<EnvironmentResource>

getEnvironmentFromSuffix

  • Looks up an environment given a domain suffix.

    export

    Parameters

    • domainSuffix: string

      the suffix to look for

    • serviceSid: string

      the service the environment belongs to

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<EnvironmentResource>

getLog

  • Calls the API to retrieve a list of all assets

    Parameters

    • logSid: Sid

      SID of log to retrieve

    • environmentSid: Sid

      environment in which to get logs

    • serviceSid: Sid

      service to look for logs

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<LogApiResource>

getOrCreateAssetResources

getOrCreateFunctionResources

  • Given a list of functions it will create the ones that don't exist and retrieves the others

    export

    Parameters

    Returns Promise<FunctionResource[]>

getService

isEnvironmentSid

  • isEnvironmentSid(str: string): boolean
  • Checks if a string is an environment SID by checking its prefix and length

    export

    Parameters

    • str: string

      the string to check

    Returns boolean

isFunctionSid

  • isFunctionSid(str: string): boolean
  • Checks if a string is an function SID by checking its prefix and length

    export

    Parameters

    • str: string

      the string to check

    Returns boolean

listAssetResources

  • Calls the API to retrieve a list of all assets

    Parameters

    Returns Promise<AssetApiResource[]>

listBuilds

  • Returns a list of all builds related to service

    export

    Parameters

    Returns Promise<BuildResource[]>

listEnvironments

  • Lists all environments for a given service

    export

    Parameters

    Returns Promise<EnvironmentResource[]>

listFunctionResources

  • Lists all functions associated to a service

    export

    Parameters

    Returns Promise<FunctionApiResource[]>

listFunctionVersions

listLogResources

  • Calls the API to retrieve a list of all assets

    Parameters

    Returns Promise<LogApiResource[]>

listOnePageLogResources

  • Calls the API to retrieve a list of all assets

    Parameters

    Returns Promise<LogApiResource[]>

listServices

listVariablesForEnvironment

  • Lists all variables for a given environment

    export

    Parameters

    • environmentSid: string

      the environment to get the variables for

    • serviceSid: string

      the service the environment belongs to

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<VariableResource[]>

removeEnvironmentVariables

  • removeEnvironmentVariables(keys: string[], environmentSid: string, serviceSid: string, client: TwilioServerlessApiClient): Promise<boolean>
  • Deletes all variables matching the passed keys from an environment

    export

    Parameters

    • keys: string[]

      the keys of the variables to delete

    • environmentSid: string

      the environment the variables belong to

    • serviceSid: string

      the service the environment belongs to

    • client: TwilioServerlessApiClient

      API client instance

    Returns Promise<boolean>

setEnvironmentVariables

  • Sets or updates the values passed in an object of environment variables for a specfic environment

    export

    Parameters

    • envVariables: EnvironmentVariables

      the object of variables

    • environmentSid: string

      the environment the varibales should be set for

    • serviceSid: string

      the service the environment belongs to

    • client: TwilioServerlessApiClient

      API client

    • Default value removeRedundantOnes: boolean = false

    Returns Promise<void>

triggerBuild

  • Triggers a new build by creating it

    export

    Parameters

    • config: BuildConfig

      build-related information (functions, assets, dependencies)

    • serviceSid: string

      the service to create the build for

    • client: TwilioServerlessApiClient

      API client

    Returns Promise<BuildResource>

uploadAsset

  • Uploads a given asset by creating a new version and uploading the content there

    export

    Parameters

    Returns Promise<Sid>

uploadFunction

  • Uploads a given function by creating a new version, reading the content if necessary and uploading the content

    export

    Parameters

    Returns Promise<Sid>

waitForSuccessfulBuild

  • waitForSuccessfulBuild(buildSid: string, serviceSid: string, client: TwilioServerlessApiClient, eventEmitter: EventEmitter, timeout?: number): Promise<void>
  • Resolves only when build has been completed. Will timeout after specified time.

    export

    Parameters

    • buildSid: string

      the build to wait for

    • serviceSid: string

      the service of the build

    • client: TwilioServerlessApiClient

      API client

    • eventEmitter: EventEmitter

      optional event emitter to communicate current build status

    • Default value timeout: number = 5 * 60 * 1000

      optional timeout. default: 5 minutes

    Returns Promise<void>

Generated using TypeDoc