Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebhookJob

Hierarchy

  • Job
    • WebhookJob

Index

Constructors

constructor

Properties

Protected e

Protected id

id: string

Protected lifeCycle

lifeCycle: LifeEvent[]

Protected locallyAvailable

locallyAvailable: boolean

Protected name

name: string

Protected nest

nest: Nest

Protected request

request: ServerRequest

Protected response

response: ClientResponse

Protected tunnel

tunnel: Tunnel

Methods

Protected createLifeEvent

  • createLifeEvent(verb: string, start: string, finish: string): void

fail

  • fail(reason: string): void
  • Function to call to fail a job while in a tunnel.

    Parameters

    • reason: string

    Returns void

getDataAsFileJob

  • getDataAsFileJob(callback: any): void
  • Gets a FileJob from the request body with a temporary file name. The callback will be given the job as its parameter.

    Example

     webhookJob.getDataAsFileJob(function(fileJob){
         fileJob.rename("myfile.zip");
         fileJob.move(af.createFolderNest("/var/out/webhook"));
     });
    

    Parameters

    • callback: any

    Returns void

getDataAsString

  • getDataAsString(callback: any): void
  • Get a string from the request body. The given callback is given a string parameter.

    Example

    webhookJob.getDataAsString(function(requestBody){
        console.log(requestBody);
    });
    

    Parameters

    • callback: any

    Returns void

getId

  • getId(): string

getLifeCycle

getName

  • getName(): string

getNameProper

  • getNameProper(): string

getNest

getRequest

  • getRequest(): ServerRequest

getResponse

  • getResponse(): ClientResponse

getTunnel

getUrlParameter

  • getUrlParameter(parameter: string): any
  • Return a specific URL parameter.

    Example

    // Webhook URL: /hooks/my/hook?customer_id=MyCust
    var customer_id = webhookJob.getUrlParameter("customer_id");
    // customer_id => MyCust
    

    Parameters

    • parameter: string

    Returns any

getUrlParameters

  • getUrlParameters(): any
  • Return all URl parameters.

    • Example

      // Webhook URL: /hooks/my/hook?customer_id=MyCust&file_name=MyFile.zip
      var query = webhookJob.getUrlParameters();
      // query => {customer_id: "MyCust", file_name: "MyFile.zip"}
      

    Returns any

isLocallyAvailable

  • isLocallyAvailable(): boolean

setLocallyAvailable

  • setLocallyAvailable(available: boolean): void

setName

  • setName(name: string): void

setNest

  • setNest(nest: Nest): void

setTunnel

  • setTunnel(tunnel: Tunnel): void

toString

  • toString(): string

transfer

  • transfer(tunnel: Tunnel): void

Generated using TypeDoc