Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TwilioServerlessApiClient

Hierarchy

  • EventEmitter
    • TwilioServerlessApiClient

Index

References

EventEmitter

Re-exports EventEmitter

Constructors

constructor

Properties

Private client

client: GotClient

The got client that is used to make all the API requests

memberof

TwilioServerlessApiClient

Private config

config: ClientConfig

Contains the client config used to do API requests

memberof

TwilioServerlessApiClient

Private limit

limit: Limit
memberof

TwilioServerlessApiClient

Static Readonly captureRejectionSymbol

captureRejectionSymbol: unique symbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: unique symbol

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods

activateBuild

  • "Activates" a build by taking a specified build SID or a "source environment" and activating the same build in the specified environment.

    Can optionally create the new environment when called with activateConfig.createEnvironment

    Parameters

    • activateConfig: ActivateConfig

      Config to specify which build to activate in which environment

    Returns Promise<ActivateResult>

    Promise Object containing meta information around deployment

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

deployLocalProject

  • Deploys a local project by reading existing functions and assets from deployConfig.cwd and calling this.deployProject with it.

    Functions have to be placed in a functions or src directory to be found. Assets have to be placed into an assets or static directory.

    Nested folder structures will result in nested routes.

    Parameters

    Returns Promise<DeployResult>

    Promise Object containing meta information around deployment

deployProject

  • Deploys a set of functions, assets, variables and dependencies specified in deployConfig. Functions & assets can either be paths to the local filesystem or Buffer instances allowing you to dynamically upload even without a file system.

    Unless a deployConfig. serviceSid is specified, it will try to create one. If a service with the name deployConfig.serviceName already exists, it will throw an error. You can make it use the existing service by setting overrideExistingService to true.

    Updates to the deployment will be emitted as events to status-update. Example:

    client.on('status-update', ({ status, message }) => {
     console.log('[%s]: %s', status, message);
    })
    

    Parameters

    Returns Promise<DeployResult>

    Promise Object containing meta information around deployment

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getClient

  • Returns the internally used GotClient instance used to make API requests

    Returns GotClient

    A client instance with set-up credentials

getEnvironmentVariables

  • Retrieves a list of environment variables for a given Twilio Serverless environment. If config.getValues is false (default) the values will be all set to undefined.

    memberof

    TwilioServerlessApiClient

    Parameters

    Returns Promise<GetEnvironmentVariablesResult>

getLogs

getLogsStream

getMaxListeners

  • getMaxListeners(): number

list

  • Returns an object containing lists of services, environments, variables functions or assets, depending on which have beeen requested in listConfig

    Parameters

    • listConfig: ListConfig

      Specifies info around which things should be listed

    Returns Promise<ListResult>

    Promise Object containing the different lists.

listenerCount

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeEnvironmentVariables

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

request

  • request(method: HTTPAlias, path: string): Promise<Response<unknown>>
  • request(method: HTTPAlias, path: string, options: OptionsOfJSONResponseBody): Promise<Response<unknown>>
  • request(method: HTTPAlias, path: string, options: OptionsOfTextResponseBody): Promise<Response<string>>
  • Parameters

    • method: HTTPAlias
    • path: string

    Returns Promise<Response<unknown>>

  • Parameters

    • method: HTTPAlias
    • path: string
    • options: OptionsOfJSONResponseBody

    Returns Promise<Response<unknown>>

  • Parameters

    • method: HTTPAlias
    • path: string
    • options: OptionsOfTextResponseBody

    Returns Promise<Response<string>>

setEnvironmentVariables

  • Sets a set of environment variables for a given Twilio Serverless environment If append is false it will remove all existing environment variables.

    memberof

    TwilioServerlessApiClient

    Parameters

    Returns Promise<SetEnvironmentVariablesResult>

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static on

  • on(emitter: EventEmitter, event: string): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>

Generated using TypeDoc