@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
286 lines (129 loc) • 3.94 kB
Markdown
---
lang: en
title: 'API docs: context.invocationcontext'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.invocationcontext.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/context](./context.md) > [InvocationContext](./context.invocationcontext.md)
## InvocationContext class
InvocationContext represents the context to invoke interceptors for a method. The context can be used to access metadata about the invocation as well as other dependencies.
**Signature:**
```typescript
export declare class InvocationContext extends Context
```
**Extends:** [Context](./context.context.md)
## Constructors
<table><thead><tr><th>
Constructor
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
[(constructor)(parent, target, methodName, args, source)](./context.invocationcontext._constructor_.md)
</td><td markdown="1">
</td><td markdown="1">
Construct a new instance of `InvocationContext`
</td></tr>
</tbody></table>
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
[args](./context.invocationcontext.args.md)
</td><td markdown="1">
`readonly`
</td><td markdown="1">
[InvocationArgs](./context.invocationargs.md)
</td><td markdown="1">
</td></tr>
<tr><td markdown="1">
[description](./context.invocationcontext.description.md)
</td><td markdown="1">
`readonly`
</td><td markdown="1">
string
</td><td markdown="1">
Description of the invocation
</td></tr>
<tr><td markdown="1">
[methodName](./context.invocationcontext.methodname.md)
</td><td markdown="1">
`readonly`
</td><td markdown="1">
string
</td><td markdown="1">
</td></tr>
<tr><td markdown="1">
[source?](./context.invocationcontext.source.md)
</td><td markdown="1">
`readonly`
</td><td markdown="1">
[InvocationSource](./context.invocationsource.md)<!-- --><unknown> \| undefined
</td><td markdown="1">
_(Optional)_
</td></tr>
<tr><td markdown="1">
[target](./context.invocationcontext.target.md)
</td><td markdown="1">
`readonly`
</td><td markdown="1">
object
</td><td markdown="1">
</td></tr>
<tr><td markdown="1">
[targetClass](./context.invocationcontext.targetclass.md)
</td><td markdown="1">
`readonly`
</td><td markdown="1">
Function
</td><td markdown="1">
The target class, such as `OrderController`
</td></tr>
<tr><td markdown="1">
[targetName](./context.invocationcontext.targetname.md)
</td><td markdown="1">
`readonly`
</td><td markdown="1">
string
</td><td markdown="1">
The target name, such as `OrderController.prototype.cancelOrder`
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
[assertMethodExists()](./context.invocationcontext.assertmethodexists.md)
</td><td markdown="1">
</td><td markdown="1">
Assert the method exists on the target. An error will be thrown if otherwise.
</td></tr>
<tr><td markdown="1">
[invokeTargetMethod(options)](./context.invocationcontext.invoketargetmethod.md)
</td><td markdown="1">
</td><td markdown="1">
Invoke the target method with the given context
</td></tr>
<tr><td markdown="1">
[toString()](./context.invocationcontext.tostring.md)
</td><td markdown="1">
</td><td markdown="1">
</td></tr>
</tbody></table>