The name of the contract.
Specifies that a service should provide error details, such as stack traces, in errors that are returned to the client. This decorator should not be used in production.
@Contract("Calculator")
@Debug()
export class CalculatorService {
...
}
Specifies that the body of a REST message should be passed to the decorated parameter of a service operation.
In this example the body of the message, a json object containing the task to create, is passed to the task
parameter on the createTask
service method.
@Operation()
@WebPost("/")
createTask(@InjectBody() task: Task, callback: Callback): void {
...
}
Specifies that a method on a service is an operation on a service contract.
The options for the operation.
Allows configuration of options for a service.
The options for the service.
Specifies that VersioningBehavior should be used for a service contract. If used, the version of the contract must be provided in semver format.
The options provided to the VersioningBehavior.
@Contract("Calculator")
@Versioning({ version: "1.0.0" })
export class CalculatorService {
...
}
Specifies that the operation is callable via a HTTP DELETE request. This is a shortcut for WebInvoke with a method of "DELETE".
The URL template for the operation. For more information, see UrlTemplate.
@Operation()
@WebDelete("/{id}")
deleteTask(id: number, callback: Callback): void {
...
}
Specifies that the operation is callable via a HTTP GET request. This is a shortcut for WebInvoke with a method of "GET".
The URL template for the operation. For more information, see UrlTemplate.
@Operation()
@WebGet("/")
getTasks(callback: ResultCallback<Tasks[]>): void {
...
}
Specifies that the operation is callable via a HTTP HEAD request. This is a shortcut for WebInvoke with a method of "HEAD".
The URL template for the operation. For more information, see UrlTemplate.
@Operation()
@WebHead("/{id}")
taskExists(id: number, callback: ResultCallback<boolean>): void {
...
}
Specifies that the operation is callable via a REST api. This is useful for supporting HTTP methods that do not have shortcut decorators. Shortcut decorators are available for GET, POST, PUT DELETE, and HEAD methods.
Describes how the operation should be called.
@Operation()
@WebInvoke({ method: "OPTIONS", template: "/{id}" })
getOptions(id: number, callback: ResultCallback<AvailableOptions>): void {
...
}
Specifies that the operation is callable via a HTTP POST request. This is a shortcut for WebInvoke with a method of "POST".
The URL template for the operation. For more information, see UrlTemplate.
@Operation()
@WebPost("/")
createTask(@InjectBody() task: Task, callback: ResultCallback<number>): void {
...
}
Specifies that the operation is callable via a HTTP PUT request. This is a shortcut for WebInvoke with a method of "PUT".
The URL template for the operation. For more information, see UrlTemplate.
@Operation()
@WebPut("/{id}")
updateTask(id: number, @InjectBody() task: Task, callback: Callback): void {
...
}
Generated using TypeDoc
Specifies that a class implements a contract.